我在使用MS Dynamics CRM 2013 SOAP API创建案例(又名事件)实体时遇到问题。我认为我已经把它缩小到一个与定制类型有关的参考的麻烦,但是尽管进行了相当多的研究,但仍然无法解决。如何使用SOAP API在Microsoft Dynamics CRM 2013中创建案例实体?
下面是我使用的创建XML:
<create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<entity>
<b:attributes>
<b:keyvaluepairofstringanytype>
<c:key>customerid</c:key>
<c:value i:type="b:EntityReference">
<b:id>a24fb802-557d-e411-a345-6c3be5a86468</b:id>
<b:logicalname>account</b:logicalname>
<b:name>Testing Account</b:name>
</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>new_email</c:key>
<c:value i:type="d:string">[email protected]</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>new_phone</c:key>
<c:value i:type="d:string">111-222-3333</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>description</c:key>
<c:value i:type="d:string">This is a test. Please do not respond to this case.</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>statuscode</c:key>
<c:value i:type="b:OptionSetValue">
<b:value>1</b:value>
</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>prioritycode</c:key>
<c:value i:type="b:OptionSetValue">
<b:value>2</b:value>
</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>new_date</c:key>
<c:value i:type="d:dateTime">2014-12-06T09:56:00</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>new_cstadmin</c:key>
<c:value i:type="b:OptionSetValue">
<b:value>100000015</b:value>
</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>title</c:key>
<c:value i:type="d:string">Test Case by XYZ</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>subjectid</c:key>
<c:value i:type="b:EntityReference">
<b:id>41b106d1-074a-e411-b697-9cb654957388</b:id>
</c:value>
</b:keyvaluepairofstringanytype>
</b:attributes>
<b:logicalname>incident</b:logicalname>
</entity>
</create>
当我提出这一点,我得到一个HTTP-500回来了,错误,
您应该指定一个父联系人或帐户
我认为这意味着这块xml ...
<b:keyvaluepairofstringanytype>
<c:key>customerid</c:key>
<c:value i:type="b:EntityReference">
<b:id>a24fb802-557d-e411-a345-6c3be5a86468</b:id>
<b:logicalname>account</b:logicalname>
<b:name>Testing Account</b:name>
</c:value>
</b:keyvaluepairofstringanytype>
...没有充分参考案例的父帐户。所以我认为我的语法是不正确的。我选择这种语法的原因是,它反映了我检索案例时返回的相同表单。
我也尝试了稍微不同的语法通过准备“客户ID”和“customeridtype”属性作为单独的键值对,如:
<b:keyvaluepairofstringanytype>
<c:key>customeridtype</c:key>
<c:value i:type="d:string">account</c:value>
</b:keyvaluepairofstringanytype>
<b:keyvaluepairofstringanytype>
<c:key>customerid</c:key>
<c:value i:type="b:EntityReference">
<b:id>a24fb802-557d-e411-a345-6c3be5a86468</b:id>
</c:value>
</b:keyvaluepairofstringanytype>
...但仍,没有骰子。
任何人有任何想法?
你是怎么创建这个XML的? – 2014-12-07 11:23:48
我正在使用云到云平台服务 - itDuzzit - 将它放在一起。 – 2014-12-07 16:02:23