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

//C#代码

//UpdateStateValueRequest updateStateValue = new UpdateStateValueRequest

//{

//    AttributeLogicalName = "statecode",

//    EntityLogicalName = "new_account_product",

//    Value = 1,

//    Label = new Label("关闭了", 2052)

//};

function demo() {

//实体名称

var entityname = "new_account_product";

//属性名称

var attrname = "statecode";

//值

var v = 1;

//相应文本

var value = "关闭了";

updatestatevalue(entityname,attrname,v, value);

}

function updatestatevalue(entityname,attrname,v,value) {

var resquest = "<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:UpdateStateValueRequest‘ 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>Value</b:key>" +

"<b:value i:type=‘c:int‘ xmlns:c=‘http://www.w3.org/2001/XMLSchema‘>"+ v +"</b:value>" +

"</a:KeyValuePairOfstringanyType>" +

"<a:KeyValuePairOfstringanyType>" +

"<b:key>MergeLabels</b:key>" +

"<b:value i:type=‘c:boolean‘ xmlns:c=‘http://www.w3.org/2001/XMLSchema‘>false</b:value>" +

"</a:KeyValuePairOfstringanyType>" +

"<a:KeyValuePairOfstringanyType>" +

"<b:key>AttributeLogicalName</b:key>" +

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

"</a:KeyValuePairOfstringanyType>" +

"<a:KeyValuePairOfstringanyType>" +

"<b:key>EntityLogicalName</b:key>" +

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

"</a:KeyValuePairOfstringanyType>" +

"<a:KeyValuePairOfstringanyType>" +

"<b:key>Label</b:key>" +

"<b:value i:type=‘a:Label‘>" +

"<a:LocalizedLabels>" +

"<a:LocalizedLabel>" +

"<MetadataId i:nil=‘true‘ xmlns=‘http://schemas.microsoft.com/xrm/2011/Metadata‘ />" +

"<HasChanged i:nil=‘true‘ xmlns=‘http://schemas.microsoft.com/xrm/2011/Metadata‘ />" +

"<a:IsManaged i:nil=‘true‘ />" +

"<a:Label>"+  value +"</a:Label>" +

"<a:LanguageCode>2052</a:LanguageCode>" +

"</a:LocalizedLabel>" +

"</a:LocalizedLabels>" +

"<a:UserLocalizedLabel i:nil=‘true‘ />" +

"</b:value>" +

"</a:KeyValuePairOfstringanyType>" +

"</a:Parameters>" +

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

"<a:RequestName>UpdateStateValue</a:RequestName>" +

"</request>" +

"</Execute>" +

"</s:Body>" +

"</s:Envelope>";

execSoap(resquest);

}

//获取服务地址

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/Delete");

ajaxRequest.send(request);

}

时间: 2024-12-16 18:57:48

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

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# 代码: //DeleteOptionValueRequest request = new DeleteOptionValueRequest(); //request.OptionSetName = "new_year"; //request.Value = 2008; //DeleteOptionValueResponse response = (DeleteOptionValueResponse)service.Execute(request); //js例子 functi

获取下拉框的文本值和value值

http://www.cnblogs.com/djgs/p/3691979.html?utm_source=tuicool&utm_medium=referral 现在有一个Id为AreaId的下拉框,要获取它当前选择项的文本和值有以下方法: <span class="red">* </span> 地       区: <span> <select id="AreaId" name="AreaId"

crm使用soap删除下拉框

//C# 代码: //DeleteOptionSetRequest request = new DeleteOptionSetRequest(); //request.Name = "new_year"; //DeleteOptionSetResponse response = (DeleteOptionSetResponse)service.Execute(request); //js样例 function demo() { //属性名称 var attrName = "n

JavaScrip单选,下拉框,文本框取值赋值--【DRP】

代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Co

下拉框与文本框重叠,即可以录入又可以选择的效果。

<div style="position:relative;"> <span style="margin-left: 100px; width: 18px; overflow: hidden;"> <select id="brand" name="brandId" style="width:150px; margin-left:-100px;height:21px;">

下拉框只显示最初下拉框中的值和json返回array的交集

首先我们可以遍历dropdown var array = new Array(); $("#select option").each(function(j){ array[j]=$(this).val(); $("#select option[value="+this.value+"]").remove(); }); 先将下拉框里的值都存到一个array里再move了,然后再和json里的array相比较 for(var i = 0;i<a

easyui的combobox下拉框初始化默认值以及保持该值一直显示的方法

easyui的combobox下拉框默认初始值是空,下面是实现从远程加载数据之后初始化默认值,以及让该值一直排在下拉框的最顶部的方式. 目前的需求是需要在初始化的时候添加"全部数据库"字段,并且在下拉的时候,"全部数据库"一直排在最顶部. 初始化效果如下: 下拉之后的效果如下: 实现方式: easyui的combobox有一个loader属性,easyui的API对loader属性说明如下: easyui的combobox有一个onLoadSuccess事件,eas