使用执行-UpdateRequest + soap XML更新CRM 2011中的数据 [英] Update data in CRM 2011 using Execute - UpdateRequest + soap XML

查看:46
本文介绍了使用执行-UpdateRequest + soap XML更新CRM 2011中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过执行以下查询来更新DCRM-2011中的数据

I want to update the data in DCRM-2011 by executing query like,

update customers set customer_name='SUDHIL-2' where customer_id in('CU102','CU103')

如何通过执行来实现-请求更新请求?
我的SOAP请求如下,

How can I achieve this via Execute-Request UpdateRequest? My SOAP request is as below,

<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:UpdateRequest" 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>Target</b:key>
                        <b:value i:type="a:Entity">
                            <a:Attributes>                        
                                <a:KeyValuePairOfstringanyType>
                                    <b:key>customer_name</b:key>
                                    <b:value i:type="a:OptionSetValue">
                                        <a:Value>SUDHIL-2</a:Value>
                                    </b:value>
                                </a:KeyValuePairOfstringanyType>                                                            
                            </a:Attributes>
                            <a:EntityState i:nil="true"/>
                            <a:FormattedValues/>
                            <a:Id>f450b346-69e7-e411-80d4-0050568c1f85</a:Id>
                            <a:LogicalName>customers</a:LogicalName>
                            <a:RelatedEntities/>
                        </b:value>
                    </a:KeyValuePairOfstringanyType>
                </a:Parameters>
                <a:RequestId i:nil="true"/>
                <a:RequestName>Update</a:RequestName>
            </request>
        </Execute>
    </s:Body>
</s:Envelope>

有人可以帮我吗?

感谢您的支持?

Ashish Mishra

Ashish Mishra

推荐答案

更新请求只能针对单个记录。您首先需要检索符合条件的实体,然后可以遍历结果并使用其ID向每个实体发出更新请求。

The Update request can only target a single record. You will first need to retrieve the entities that match your criteria and then you can loop through the results and issue Update requests for each one using their ID.

这篇关于使用执行-UpdateRequest + soap XML更新CRM 2011中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆