Soap 使用Microsoft Dynamics CRM web服务获取自定义选项集值
CRM有一些自定义的选项集,例如,为联系人实体定义了称呼选项集。我需要在创建或更新联系人时获取此选项集的值。我尝试使用Soap 使用Microsoft Dynamics CRM web服务获取自定义选项集值,soap,dynamics-crm-2011,Soap,Dynamics Crm 2011,CRM有一些自定义的选项集,例如,为联系人实体定义了称呼选项集。我需要在创建或更新联系人时获取此选项集的值。我尝试使用retrieveoptionstartrequest获取选项集值,如下所示: 要使用的SOAP操作http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute SOAP请求主体 <s:Envelope xmlns:s="http://schemas.xmlsoap.
retrieveoptionstart
request获取选项集值,如下所示:
要使用的SOAP操作http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute
SOAP请求主体
<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="a:RetrieveOptionSetRequest" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
<a:Parameters xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringanyType>
<b:key>MetadataId</b:key>
<b:value i:type="c:guid" xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/">00000000-0000-0000-0000-000000000000</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>RetrieveAsIfPublished</b:key>
<b:value i:type="c:boolean" xmlns:c="http://www.w3.org/2001/XMLSchema">true</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>Name</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">my_type</b:value>
</a:KeyValuePairOfstringanyType>
</a:Parameters>
<a:RequestId i:nil="true" />
<a:RequestName>RetrieveOptionSet</a:RequestName>
</request>
</Execute>
</s:Body>
</s:Envelope>
给了我有用的信息。我想你的问题几个月前在这个链接中得到了回答:
如果不一样,请告诉我,我们将尝试另一种方法;)
但再想想你们的需求,若我已经正确理解了它,那个么这个选项集多久会改变一次?为什么不直接从SDK中检索带有crmsvcutil.exe的选项集呢
干杯
Mario您需要使用RetrieveAttributeRequest,而不是RetrieveOptionSetRequest
非全局(本地)选项集的元数据定义为实体本身属性的一部分,而不是完全不同的结构。即,如果从实体中删除本地optionset属性,则会丢失整个选项集定义。但是如果是全局optionset,删除实体上的属性引用不会导致选项集的任何数据丢失因为op直接在SOAP中工作,我假设他使用的是javascript或.NET以外的其他东西,这就是你链接上的答案所在。我只是不想让任何人关闭它,因为问题如此相似1为了找到链接,我使用Java来检索这些选项。我们可以使用这个JS方法访问一些外部数据,基本上我们需要动态添加选项集(CRM系统中的optionset值中不存在)。类似于DependentTopSet JS中所做的事情,我们从其他来源获取XML?@AshishJain所以基本上你想假装OptionSet中有值,而不是OptionSet中的值?基本上我的详细查询是在,如果有用的话。
<s:Envelope>
<s:Body>
<Execute>
<request i:type="a:RetrieveAttributeRequest">
<a:Parameters>
<a:KeyValuePairOfstringanyType>
<b:key>MetadataId</b:key>
<b:value i:type="c:guid">00000000-0000-0000-0000-000000000000</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>RetrieveAsIfPublished</b:key>
<b:value i:type="c:boolean">true</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>EntityLogicalName</b:key>
<b:value i:type="c:string">contact</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>LogicalName</b:key>
<b:value i:type="c:string">my_type</b:value>
</a:KeyValuePairOfstringanyType>
</a:Parameters>
<a:RequestId i:nil="true"/>
<a:RequestName>RetrieveAttribute</a:RequestName>
</request>
</Execute>
</s:Body>
</s:Envelope>