crm使用soap删除下拉框

//C# 代码:

//DeleteOptionSetRequest request = new DeleteOptionSetRequest();

//request.Name = "new_year";

//DeleteOptionSetResponse response = (DeleteOptionSetResponse)service.Execute(request);

//js样例

function demo() {

//属性名称

var attrName = "new_year";

deleteOption(attrName);

}

function deleteOption(attrName) {

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:DeleteOptionSetRequest‘ 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>Name</b:key>";

request += "<b:value i:type=‘c:string‘ xmlns:c=‘http://www.w3.org/2001/XMLSchema‘>"+ attrName +"</b:value>";

request += "</a:KeyValuePairOfstringanyType>";

request += "</a:Parameters>";

request += "<a:RequestId i:nil=‘true‘ />";

request += "<a:RequestName>DeleteOptionSet</a:RequestName>";

request += "</request>";

request += "</Execute>";

request += "</s:Body>";

request += "</s:Envelope>";

execSoap(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);

}

时间: 2024-10-02 21:55:36

crm使用soap删除下拉框的相关文章

crm使用soap删除下拉框选项

//C# 代码: //DeleteOptionValueRequest request = new DeleteOptionValueRequest(); //request.OptionSetName = "new_year"; //request.Value = 2008; //DeleteOptionValueResponse response = (DeleteOptionValueResponse)service.Execute(request); //js例子 functi

crm使用soap创建下拉框

//C#代码 //#region OptionMetadataCollection //OptionMetadataCollection opCollection = new OptionMetadataCollection(); //opCollection.Add(new OptionMetadata(new Label("2000年", languageCode), 2000)); //opCollection.Add(new OptionMetadata(new Label(&

crm使用soap插入下拉框选项

//C# 代码: //InsertOptionValueRequest request = new InsertOptionValueRequest(); //request.OptionSetName = "new_year"; //request.Label = new Label("2008年", languageCode); //request.Value = 2008; //InsertOptionValueResponse response = (Ins

crm使用soap更改下拉框的文本值

//C#代码 //UpdateStateValueRequest updateStateValue = new UpdateStateValueRequest //{ //    AttributeLogicalName = "statecode", //    EntityLogicalName = "new_account_product", //    Value = 1, //    Label = new Label("关闭了", 20

JavaScript向select下拉框中添加和删除元素

JavaScript向select下拉框中添加和删除元素 1.说明 a   利用append()方法向下拉框中添加元素 b   利用remove()方法移除下拉框中最后一个元素 2.设计源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xm

JQuery打造下拉框联动效果

做联动效果,若是用纯JavaScript来做,往往须要辅助页面保存须要刷新的结果集,然后渲染到原页面.考虑将须要动态刷新的内容自己主动拼接到前一个下拉框之后,当前一个下拉框onchange后,同级的后面的下拉框所有清除,然后又一次拼接刷新的内容.用JQuery实现比較easy,代码以省市联动效果为例实现. JSP页面代码例如以下: <li id="base"> <p>生源地:</p> <label> <select id="

Web 1三级联动 下拉框 2添加修改删除 弹框

Web  三级联动 下拉框 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { private MyDBDataContext _Context = new MyDBD

ZP的EXTJS学习笔记(三)——邮箱功能的开发(按钮事件、下拉框、分页、record小图标、整条数据格式处理、定时刷新、record复选删除、分组)

照例,先贴效果图: 本人比较满意,短时间开发的邮箱功能,这是收件箱,还有配套的发件箱与删除箱. 简单说下思路: 1.配置model.store,用的是MVC模式,可参考第一篇学习笔记. 2.页面简单布局: Ext.define('KitchenSink.view.mail.InBox', { extend: 'Ext.grid.Panel', alias : 'widget.inbox', xtype: 'inbox', autoHeight:true, bodyStyle:'width:100

javascript 可多选的下拉框 multiselect 动态删除option值,动态添加option值,动态生成表格

首先引用一个写的很好的博客http://www.cnblogs.com/landeanfen/p/5013452.html 我使用的是bootstrap-multiselect,实现功能是 选择下拉框中的某几项数据后,通过点击add按键,可以将数据动态的添加到一个table中: 移除掉下拉框中的这几项: 删除table中的某行数据,对应的下拉框中会再添加这些值. bootstrap-multiselect源码主页:https://github.com/davidstutz/bootstrap-m