[英]Send picklist value to Dynamics crm online to create lead using soap php
I am trying to create a lead in crm 365 online using soap in php.我正在尝试使用 php 中的肥皂在线创建 crm 365 中的领先者。 I can create a lead successfully by sending soap request but I want to send leadsource as well and it's a picklist in crm.
我可以通过发送soap请求成功创建潜在客户,但我也想发送leadsource,它是crm中的一个选择列表。 Here is my code in php.
这是我在 php 中的代码。 Not sure which datatype to use, int32 or picklist, but both are not working.
不确定要使用哪种数据类型,int32 或选择列表,但两者都不起作用。
<b:KeyValuePairOfstringanyType>
<c:key>leadsourcecode</c:key>
<c:value i:type="d:OptionSetValue" xmlns:d="http://www.w3.org/2001/XMLSchema">100000010</c:value>
</b:KeyValuePairOfstringanyType>';
I am getting this error:我收到此错误:
Sendera:DeserializationFailedThe formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/xrm/2011/Contracts/Services:entity. The InnerException message was 'Error in line 22 position 82. Element 'http://schemas.datacontract.org/2004/07/System.Collections.Generic:value' contains data from a type that maps to the name 'http://www.w3.org/2001/XMLSchema:OptionSetValue'. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name 'OptionSetValue' and namespace 'http://www.w3.org/2001/XMLSchema'.'. Please see InnerException for more details.
Can you try this?你能试试这个吗?
<a:keyvaluepairofstringanytype>
<b:key>leadsourcecode</b:key>
<b:value i:type="a:OptionSetValue">
<a:value>100000010</a:value>
</b:value>
</a:keyvaluepairofstringanytype>
You need to have a capital V for the inner value tag.您需要为内部值标签使用大写字母 V。 Here is code that works that I use to update the status reason, modify as appropriate.
这是我用来更新状态原因的有效代码,请酌情修改。 Also, the SOAP endpoint is deprecated, you should move to the WebAPI
此外,不推荐使用 SOAP 端点,您应该移至 WebAPI
request += "<a:KeyValuePairOfstringanyType>";
request += "<c:key>Status</c:key>";
request += "<c:value i:type=\"a:OptionSetValue\">";
request += "<a:Value>" + 2 + "</a:Value>";
request += "</c:value>";
request += "</a:KeyValuePairOfstringanyType>";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.