2013-04-03 53 views
1

我设法让一个成功的在线连接使用PHP的动态CRM 2011年 我甚至成功地创建一个新的主角,并添加以下给出的值:增值查找场CRM动态2011

<s:Body> 
       <Create 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>name</c:key> 
          <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Test Here</c:value> 
         </b:KeyValuePairOfstringanyType> 
         <b:KeyValuePairOfstringanyType> 
          <c:key>emailaddress1</c:key> 
          <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">[email protected]</c:value> 
         </b:KeyValuePairOfstringanyType> 
         <b:KeyValuePairOfstringanyType> 
          <c:key>address1_city</c:key> 
          <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Location Here</c:value> 
         </b:KeyValuePairOfstringanyType> 
         <b:KeyValuePairOfstringanyType> 
          <c:key>telephone1</c:key> 
          <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">123456</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>00000000-0000-0000-0000-000000000000</b:Id> 
        <b:LogicalName>account</b:LogicalName> 
        <b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/> 
       </entity> 
       </Create> 
      </s:Body> 

我是停留在现在的事情是如何添加一个值,以查找字段“primarycontactid”

比方说,比如我想补充我有红色的,有是“马哈茂德Jabado”

的价值一个JavaScript函数,我只是有点失落在哪里以及如何实施。 是不是有一种像上面的XML那样设置值的方法?

P.S:我在用PHP编程,编程水平也不高。 谢谢大家提前。

回答

0

有一种方法可以直接在xml中设置它,但是您需要您尝试添加的联系人的Guid。一些类似以下内容在一个古老的java应用程序我在一段时间内的工作为我工作前,所以应该为你工作了:

<b:KeyValuePairOfstringanyType> 
    <c:key>primarycontactid</c:key> 
    <c:value i:type="b:EntityReference"> 
     <b:Id>[CONTACT GUID GOES HERE]</b:Id> 
     <b:LogicalName>contact</b:LogicalName> 
     <b:Name i:nil="true" /> 
    </c:value> 
</b:KeyValuePairOfstringanyType> 

对于<b:Name>,你可以在那里把联系人姓名,但它不应该是如果您正在创建/更新记录,则为必填项。

(注:我已经猜到命名空间,所以它可能需要一点调整)