从 Apex 获取 Salesforce.com 字段的数据类型,而不是显示类型
我需要访问 Salesforce.com 对象中字段的数据类型,以便识别对象中的每个电话、传真、电子邮件和邮件字段。我已通过 SFDC Web 服务使用DescribeSObject 调用完成此操作,但 ApexDescribeFieldResult.getType 方法仅返回字段的显示类型,而不返回实际数据类型。
例如,如下图所示,显示“传真”数据类型的字段根据 getType 调用具有“电话”显示类型。我需要一些可以为传真字段返回传真、为邮件字段返回邮件等的东西,例如DescribeSObject Web 服务调用。 Apex 中是否存在这种情况?
I need to access the data types of the fields in a Salesforce.com object in order to identify each phone, fax, email, and mail field in an object. I've done this from SFDC web services with the DescribeSObject call but the Apex DescribeFieldResult.getType method only returns the display type of the field, not the actual data type.
For example, fields that display a Data Type of Fax like in the image below have a display type of Phone according the getType call. I need something that returns fax for fax fields, mail for mail fields, etc. like the DescribeSObject web service call. Does anyone if that exists in Apex?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是 APEX 没有这些信息。也就是说,由于您只能定义自定义电话和电子邮件字段,而不能定义传真和邮件/地址字段,因此可以编写所有传真和邮件字段的明确列表。因此,您可能会考虑对哪些字段是传真/邮件字段进行硬编码,并使用describeFieldResult.getType() 调用动态确定哪些字段是电话和电子邮件字段。
Unfortunately APEX doesn't have that information. That said since you can only define custom phone and email fields and not fax and mail/address fields it's possible to write a definitive list of all fax and mail fields. Thus you might consider hard coding which fields are fax/mail fields and dynamically figuring out which fields are phone and email fields use describeFieldResult.getType() calls.