如何使用SOAP API在Microsoft Dynamics CRM 2013中创建案例实体?
使用MS Dynamics CRM 2013 SOAP API创建案例实体时遇到问题。我想我已经把它缩小到了一个麻烦的customerid一个customeridtype相关的参考,但是尽管做了很多研究,还是没能解决它 下面是我正在使用的创建XML:如何使用SOAP API在Microsoft Dynamics CRM 2013中创建案例实体?,soap,dynamics-crm,Soap,Dynamics Crm,使用MS Dynamics CRM 2013 SOAP API创建案例实体时遇到问题。我想我已经把它缩小到了一个麻烦的customerid一个customeridtype相关的参考,但是尽管做了很多研究,还是没能解决它 下面是我正在使用的创建XML: <create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:b="http://schemas.microsoft.com/xrm/2011/C
<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">test@domain.com</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>
…未充分参考案例的母公司账户。所以我假设我的语法是不正确的。我选择这种语法的原因是,它反映了检索案例时返回的相同形式
我还尝试了一种稍微不同的语法,将customerid和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>
…但还是没有骰子
有人有什么想法吗?由于特殊的客户字段结构,AFAIK customerid和customeridtype都应该存在,因此我尝试将您的两种尝试混合在一起:
<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>customeridtype</c:key>
<c:value i:type="d:string">1</c:value>
</b:keyvaluepairofstringanytype>
也就是说,作为旁注,如果您可以使数据以JSON的形式显示,您可以将其发布到OData服务,从而减少痛苦的体验。客户字段是一个非常特殊的字段,因此,与其向帐户传递实体引用,不如尝试传递一个b:Customer对象,看看是否有效
另外,不要浪费时间手动生成请求,使用SOAP或REST端点等SDK工具更简单。您是如何创建此XML的?我正在使用云到云平台服务itDuzzit将其组合在一起。一个好主意,但是,当我尝试这种技术时,仍然会遇到相同的错误,您应该指定一个家长联系人或帐户。我同意OData服务可能会更加透明,但不幸的是,在这一点上,我不能选择OData服务。
<c:value i:type="d:string">1</c:value>