XML Query用于在CRM2011中保存客户端性别数据

时间:2011-08-05 11:04:50

标签: xml soap dynamics-crm dynamics-crm-4

我正在尝试使用SOAP API将数据集保存到CRM2011中。

希望有人可以解释如何保存连接数据,例如性别。

Under是最小数据的更新xml。性别在选项集中设置为1->男性,2->女性。然后,我需要xmlns并输入此数据。

正常的UPDATE设置如下所示:

更新:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <request i:type="a:UpdateRequest" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
        <a:Parameters xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
          <a:KeyValuePairOfstringanyType>
            <b:key>Target</b:key>
            <b:value i:type="a:Entity">
              <a:Attributes>
                <a:KeyValuePairOfstringanyType>
                  <b:key>accountid</b:key>
                  <b:value i:type="c:guid" xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/">5e7cd540-3098-e011-91cf-1cc1de6dbadb</b:value>
                </a:KeyValuePairOfstringanyType>
                <a:KeyValuePairOfstringanyType>
                  <b:key>name</b:key>
                  <b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">Test D2</b:value>
                </a:KeyValuePairOfstringanyType>
                <a:KeyValuePairOfstringanyType>
                  <b:key>accountnumber</b:key>
                  <b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">777</b:value>
                </a:KeyValuePairOfstringanyType>
              </a:Attributes>
              <a:EntityState i:nil="true" />
              <a:FormattedValues />
              <a:Id>5e7cd540-3098-e011-91cf-1cc1de6dbadb</a:Id>
              <a:LogicalName>account</a:LogicalName>
              <a:RelatedEntities />
            </b:value>
          </a:KeyValuePairOfstringanyType>
        </a:Parameters>
        <a:RequestId i:nil="true" />
        <a:RequestName>Update</a:RequestName>
      </request>
    </Execute>
  </s:Body>
</s:Envelope>

1 个答案:

答案 0 :(得分:1)

找到我自己的问题的答案:

<a:KeyValuePairOfstringanyType>
   <c:key>EntityMoniker</c:key>
   <c:value i:type="a:EntityReference">
      <a:Id>' + id + '</a:Id>
      <a:LogicalName>' + logicalName + '</a:LogicalName>
      <a:Name i:nil="true" />
   </c:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
   <c:key>State</c:key>
   <c:value i:type="a:OptionSetValue">
      <a:Value>0</a:Value>
   </c:value>
</a:KeyValuePairOfstringanyType>