我在使用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