简化记录类型 ID 链接
通过 PHP 使用 Salesforce SOAP API 时,如果我有一个对象,该对象具有帐户的查找字段,并且帐户上的特定字段设置为外部 ID,我可以执行以下操作:
$sfBooking->fields['Account__r'] = "<type>Account</type>"
. "<custom_account_id__c>"
. utf8_encode($tboxBooking->client_id)
. "</custom_account_id__c>";
这在以下情况下非常方便尝试链接记录而无需使用其 Salesforce ID。
我想知道在通过 API 设置对象的记录类型时是否可以使用类似类型的简写。如果可能的话,我想取消必须首先通过查询记录类型对象来获取记录类型 ID 的步骤。
When using the Salesforce SOAP API via PHP, if I have an object which has a look-up field to an account with a specific field on the account which is set up as an external id, I can do the following
$sfBooking->fields['Account__r'] = "<type>Account</type>"
. "<custom_account_id__c>"
. utf8_encode($tboxBooking->client_id)
. "</custom_account_id__c>";
This is quite handy when trying to link records without have to resort to using their Salesforce ID.
I'm wondering is there a similar type of shorthand I can use when setting up the Record Type on objects via the API. Having to get the record type id by first querying the Record Type object is a step I'd like to cut out if at all possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 RecordType 上的名称字段来执行此操作,您生成的 xml 应该看起来像
基于您发布的代码,您会这样做
You can do this using the name field on RecordType, your generated xml should look like
based on the code you posted, you'd do
大卫,我不知道设置 RecordType 的类似简写方法。不幸的是,RecordType 没有实现此目的所需的外部 ID。
我的建议是查询所有 RecordTypes 并建立一个本地查找表/DeveloperName 到 Id 的数组。然后,您可以在整个应用程序中使用此查找表/数组,根据 Salesforce 中该 RecordType 的 DeveloperName 设置正确的 RecordType Id。
David, I'm not aware of a similar shorthand method of setting the RecordType. Unfortunately the RecordType does not have an external id which is required in order to achieve this.
My recommendation would be to query all of the RecordTypes and build up a local lookup table/array of DeveloperName to Id. You can then use this lookup table/array throughout your application to set the correct RecordType Id based on the DeveloperName of that RecordType in Salesforce.