Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ms dynamics使用Java合并两个记录_Java_Dynamics Crm_Microsoft Dynamics - Fatal编程技术网

Ms dynamics使用Java合并两个记录

Ms dynamics使用Java合并两个记录,java,dynamics-crm,microsoft-dynamics,Java,Dynamics Crm,Microsoft Dynamics,我已经下载了Ms Dynamics Java集成包(不是SDK)。我能够创建、更新和删除所有实体。但现在,我正在尝试使用Java在Ms Dynamics Crm中合并两个联系人。研究结果使我一事无成。像MergeRequest这样的类用于JavaScript,但我不确定如何使用Java。我已经创建了两个联系人,并已检索到它们。我相信您使用SOAP进行CRUD操作。下面是用于合并记录的Soap: POST https://pactest.api.crm.dynamics.com/XRMServic

我已经下载了Ms Dynamics Java集成包(不是SDK)。我能够创建、更新和删除所有实体。但现在,我正在尝试使用Java在Ms Dynamics Crm中合并两个联系人。研究结果使我一事无成。像MergeRequest这样的类用于JavaScript,但我不确定如何使用Java。我已经创建了两个联系人,并已检索到它们。

我相信您使用SOAP进行CRUD操作。下面是用于合并记录的Soap:

POST https://pactest.api.crm.dynamics.com/XRMServices/2011/Organization.svc/web
Content-Type: text/xml; charset=utf-8
SOAPAction: http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute

<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="b:MergeRequest" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:b="http://schemas.microsoft.com/crm/2011/Contracts">
        <a:Parameters xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
          <a:KeyValuePairOfstringanyType>
            <c:key>Target</c:key>
            <c:value i:type="a:EntityReference">
              <a:Id>00000000-0000-0000-0000-000000000000</a:Id>
              <a:LogicalName>account</a:LogicalName>
              <a:Name i:nil="true" />
            </c:value>
          </a:KeyValuePairOfstringanyType>
          <a:KeyValuePairOfstringanyType>
            <c:key>SubordinateId</c:key>
            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">00000000-0000-0000-0000-000000000000</c:value>
          </a:KeyValuePairOfstringanyType>
          <a:KeyValuePairOfstringanyType>
            <c:key>UpdateContent</c:key>
            <c:value i:type="a:Entity">
              <a:Attributes />
              <a:EntityState i:nil="true" />
              <a:FormattedValues />
              <a:Id>00000000-0000-0000-0000-000000000000</a:Id>
              <a:LogicalName>account</a:LogicalName>
              <a:RelatedEntities />
            </c:value>
          </a:KeyValuePairOfstringanyType>
          <a:KeyValuePairOfstringanyType>
            <c:key>PerformParentingChecks</c:key>
            <c:value i:type="d:boolean" xmlns:d="http://www.w3.org/2001/XMLSchema">true</c:value>
          </a:KeyValuePairOfstringanyType>
        </a:Parameters>
        <a:RequestId i:nil="true" />
        <a:RequestName>Merge</a:RequestName>
      </request>
    </Execute>
  </s:Body>
</s:Envelope>
POSThttps://pactest.api.crm.dynamics.com/XRMServices/2011/Organization.svc/web
内容类型:text/xml;字符集=utf-8
SOAPAction:http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute
目标
00000000-0000-0000-0000-000000000000
账户
下属
00000000-0000-0000-0000-000000000000
更新内容
00000000-0000-0000-0000-000000000000
账户
进行租金检查
真的
合并

当然,您应该将Guid.Empty替换为要合并的记录的正确ID。

我将所有实体都编入类中,以便使流程更面向对象。我将尝试用我的对象模拟相同的请求并更新。感谢您的回复。在这种情况下,当我合并两个帐户时,我应该更改哪个参数来编辑获胜字段?例如,我可以保留损失账户的一个字段吗?