crm使用soap批量删除数据
//批量删除数据
function demo() {
//实体名称
var entityname = "fw_student";
var data = [];
data.push("8B1D93C6-BF1E-E411-9406-00155D005802");
data.push("20718494-0C2C-E411-9407-00155D005802");
executemultipleDelete(entityname, data);
}
function executemultipleDelete(name,iddata) {
var request = "<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>";
request += "<s:Body>";
request += "<Execute xmlns='http://schemas.microsoft.com/xrm/2011/Contracts/Services' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>";
request += "<request i:type='a:ExecuteMultipleRequest' xmlns:a='http://schemas.microsoft.com/xrm/2011/Contracts'>";
request += "<a:Parameters xmlns:b='http://schemas.datacontract.org/2004/07/System.Collections.Generic'>";
request += "<a:KeyValuePairOfstringanyType>";
request += "<b:key>Requests</b:key>";
request += "<b:value i:type='c:OrganizationRequestCollection' xmlns:c='http://schemas.microsoft.com/xrm/2012/Contracts'>";
var len = iddata.length;
for (var i = 0; i < len; i++) {
addItem(name,iddata[i]);
}
request += "</b:value>";
request += "</a:KeyValuePairOfstringanyType>";
request += "<a:KeyValuePairOfstringanyType>";
request += "<b:key>Settings</b:key>";
request += "<b:value i:type='c:ExecuteMultipleSettings' xmlns:c='http://schemas.microsoft.com/xrm/2012/Contracts'>";
request += "<c:ContinueOnError>false</c:ContinueOnError>";
request += "<c:ReturnResponses>true</c:ReturnResponses>";
request += "</b:value>";
request += "</a:KeyValuePairOfstringanyType>";
request += "</a:Parameters>";
request += "<a:RequestId i:nil='true' />";
request += "<a:RequestName>ExecuteMultiple</a:RequestName>";
request += "</request>";
request += "</Execute>";
request += "</s:Body>";
request += "</s:Envelope>";
execSoap(request);
}
function addItem(name,id) {
var request = "<c:OrganizationRequest i:type='a:DeleteRequest'>";
request += "<a:Parameters>";
request += "<a:KeyValuePairOfstringanyType>";
request += "<b:key>Target</b:key>";
request += "<b:value i:type='a:EntityReference'>";
request += "<a:Id>" + id + "</a:Id>";
request += "<a:LogicalName>"+ name +"</a:LogicalName>";
request += "<a:Name i:nil='true' />";
request += "</b:value>";
request += "</a:KeyValuePairOfstringanyType>";
request += "</a:Parameters>";
request += "<a:RequestId i:nil='true' />";
request += "<a:RequestName>Delete</a:RequestName>";
request += "</c:OrganizationRequest>";
return request;
}
//获取服务地址
function getWebUrl() {
var serverUrl = Xrm.Page.context.getServerUrl();
if (serverUrl.match(/\/$/)) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
}
return serverUrl + "/XRMServices/2011/Organization.svc/web";
}
//运行请求
function execSoap(request) {
var ajaxRequest = new XMLHttpRequest();
ajaxRequest.open("POST", getWebUrl(), true)
ajaxRequest.setRequestHeader("Accept", "application/xml, text/xml, */*");
ajaxRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
ajaxRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
ajaxRequest.send(request);
}
crm使用soap批量删除数据的更多相关文章
- EntityFramework:支持同一事务提交的批量删除数据实现思路
一切从一段代码说起... 下面一段代码是最近我在对一EF项目进行重构时发现的. protected override void DoRemove(T entity) { this.dbContext. ...
- ASP.NET MVC+EF框架+EasyUI实现权限管理系列(18)-过滤器的使用和批量删除数据(伪删除和直接删除)
原文:ASP.NET MVC+EF框架+EasyUI实现权限管理系列(18)-过滤器的使用和批量删除数据(伪删除和直接删除) ASP.NET MVC+EF框架+EasyUI实现权限管系列 (开篇) ...
- php 批量删除数据
php 批量删除数据 :比如我们在看邮箱文件的时候,积攒了一段时间以后,看到有些文件没有用了 这时候我们就会想到把这些 没用的文件删除,这时候就用到了批量删除数据的功能,这里我是用了数据库原有的一个表 ...
- sqlalchemy批量删除数据、全量删除
问题:sqlalchemy如何批量删除多条数据解决:使用参数synchronize_session=False,或for循环方法: users = self.db.query(User) ...
- mysql 批量删除数据
批量删除2000w数据 使用delete from table太慢 //DELIMITER DROP PROCEDURE if EXISTS deleteManyTable; create PROCE ...
- Hbase之批量删除数据
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; impo ...
- sql 2008批量删除数据表格
DECLARE @Table NVARCHAR(300) DECLARE @Count Int = 0 DECLARE tmpCur CURSOR FOR SELECT name FROM sys.o ...
- PHP后台批量删除数据
html <form action="" method="post"> <div><input type="submit ...
- PHP批量写入数据、批量删除数据
批量插入可以参考$sql = "insert into data (id,ip,data) values ";for($i=0;$i<100;$i++){$sqls[]=& ...
随机推荐
- (hdu step 7.1.7)Wall(求凸包的周长——求将全部点围起来的最小凸多边形的周长)
题目: Wall Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- PHP 比 Java 的开发效率高在哪?
PHP 比 Java 的开发效率高在哪? 现在很多互联网应用都是php开发的,在很多人的观念里已经把php与java分到了两个开发领域,php是互联网,java是企业应用. 都说php的开发效率高,更 ...
- TensorRT加速 ——NVIDIA终端AI芯片加速用,可以直接利用caffe或TensorFlow生成的模型来predict(inference)
官网:https://developer.nvidia.com/tensorrt 作用:NVIDIA TensorRT™ is a high-performance deep learning inf ...
- 【Codeforces 105D】 Bag of mice
[题目链接] http://codeforces.com/contest/148/problem/D [算法] 概率DP f[w][b]表示还剩w只白老鼠,b只黑老鼠,公主胜利的概率,那么 : 1. ...
- 一篇个人感觉比较好的lua入门的文章
原文转自www.cppprog.com,由三篇文章组成 Lua是一个嵌入式的脚本语言,它不仅可以单独使用还能与其它语言混合调用.Lua与其它脚本语言相比,其突出优势在于: 1. 可扩展性.Lua的扩 ...
- WPF开发“Program '*' does not contain a static 'Main' method suitable for an entry point”错误
WPF项目编译时出现“Program '*' does not contain a static 'Main' method suitable for an entry point”错误, 解决方 ...
- [原创]C++带空格字符串的输入问题
字符串一直是一个重点加难点,很多笔试面试都会涉及,带空格的字符串更是十分常见,现在对字符串的输入问题进行一下总结. C++用cin输入的时候会忽略空格以后的字符,比如 char a[100]; cin ...
- Nginx代码风格图示
Nginx代码风格图示 (100%) 一.基本原则 K&R编码风格(偏BSD子类). 每行不能超过80列. 不用TAB对齐,用空格. 默认对齐单元是4个空格. 除宏定义外,字母均为小写,单词间 ...
- winform右键菜单
public partial class Form1 : Form { ContextMenuStrip cms; Bitmap bm ; public Form1() { InitializeCom ...
- 改造PAXOS算法消灭活锁
分布式一致性协议的目的是确定一个不可变变量分布式存储的取值:通过对国内外一致性算法的研究成果和PAXOS协议活锁的分析,发现引入一个角色作为竞争时的代理提交者就可以解决活锁问题,从而在本文引入“代理提 ...