2011-09-28 85 views
1

我正在使用CRM 2011开发人员培训实验室中提供的PHP SOAP CRUD类。使用SOAP更新查找字段

该例程正常工作正常读取,创建&更新。但是,我无法确定如何定义GUID属性,例如如果我想更新联系人中的leadourceid。下面的定义。结果不是错误 - 它只是不完成更新。

$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>'; 

回答

1

要更新SOAP中的查找值,您需要使用实体引用。例如,下面更新记录的所有者。

<a:KeyValuePairOfstringanyType> 
    <b:key>ownerid</b:key> 
    <b:value i:type="a:EntityReference"> 
     <a:Id>{6710C3A0-6EE9-E211-B17C-984BE16D3DAA}</a:Id> 
     <a:LogicalName>systemuser</a:LogicalName> 
     <a:Name i:nil="true" /> 
    </b:value> 
</a:KeyValuePairOfstringanyType> 
+0

谢谢 - 这正是我所需要的! –