2015-01-07 24 views
0

我已经下载了适用于Java(不是SDK)的Ms Dynamics集成包。我能够创建,更新和删除所有实体。但是现在,我正在尝试使用Java合并Ms Dynamics Crm中的两个联系人。研究使我无处可去。像MergeRequest这样的类可以用于JavaScript,但我不知道如何去处理Java。我创建了两个联系人,并检索了他们。Ms动态合并使用Java的两条记录

回答

0

我相信你使用SOAP进行CRUD操作。这里是肥皂的记录合并:

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> 

当然,你应该用你想要的记录合并正确的ID替换Guid.Empty。

+0

为了使这个过程更加面向对象,我将所有的实体都放到了类中。我会尝试用我的对象嘲笑相同的请求并更新。感谢您的回应。 – Arjun

+0

当我在这种情况下合并两个帐户时,我要更改哪个参数来编辑获奖领域?例如,我可以让失败账户的一个字段保留吗? – Arjun