使用 SOAP 更新查找字段
我正在使用 CRM 2011 开发人员培训实验室中提供的 PHP SOAP CRUD 类。
这些例程对于标准读取、创建和读取工作正常。更新。但是,我无法弄清楚如何定义 GUID 属性,例如,如果我想更新联系人中的 Leadsourceid。定义如下。结果不是错误 - 它只是没有完成更新。
$accountsRequest = EntityUtils::getUpdateCRMSoapHeader($CRMURL, $securityData).
'<s:Body><Update xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
<entity xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<b:Attributes xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<b:KeyValuePairOfstringanyType>
<c:key>originatingleadid</c:key>
<c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">a9cc53ae-266f-e011-8d6c-1cc1de72e35e</c:value>
</b:KeyValuePairOfstringanyType>
</b:Attributes>
<b:EntityState i:nil="true"/>
<b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
<b:Id>'.$contactId.'</b:Id>
<b:LogicalName>contact</b:LogicalName>
<b:RelatedEntities />
</entity></Update>
</s:Body>
</s:Envelope>';
I'm using the PHP SOAP CRUD classes provided in the CRM 2011 Developer Training Labs.
The routines are working fine for standard read, create & updates. However, I can't work out how to define the GUID attribute, e.g. If I want to update the leadsourceid within a contact. Definition below. Result is not an error - it just doesn't complete the update.
$accountsRequest = EntityUtils::getUpdateCRMSoapHeader($CRMURL, $securityData).
'<s:Body><Update xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
<entity xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<b:Attributes xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<b:KeyValuePairOfstringanyType>
<c:key>originatingleadid</c:key>
<c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">a9cc53ae-266f-e011-8d6c-1cc1de72e35e</c:value>
</b:KeyValuePairOfstringanyType>
</b:Attributes>
<b:EntityState i:nil="true"/>
<b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
<b:Id>'.$contactId.'</b:Id>
<b:LogicalName>contact</b:LogicalName>
<b:RelatedEntities />
</entity></Update>
</s:Body>
</s:Envelope>';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要更新 SOAP 中的查找值,您需要使用实体引用。例如,以下更新记录的所有者。
To update a lookup value in SOAP you need to use an Entity Reference. The following updates the owner of the record for example.