crm使用soap插入下拉框选项

//C# 代码:

//InsertOptionValueRequest request = new InsertOptionValueRequest();

//request.OptionSetName = "new_year";

//request.Label = new Label("2008年", languageCode);

//request.Value = 2008;

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

//js例子

function demo() {

//属性名称

var attrName = "new_year";

//值

var value = "2008";

//文本

var lable = "";

//语言编码

var code = 2052;

deleteAttribute(entityname, attrname);

}

function insertOption(attrName,value,lable,code) {

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:InsertOptionValueRequest‘ 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>Label</b:key>";

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

request += "<a:LocalizedLabels>";

request += "<a:LocalizedLabel>";

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

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

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

request += "<a:Label>" + lable + "</a:Label>";

request += "<a:LanguageCode>"+ code +"</a:LanguageCode>";

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

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

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

request += "</b:value>";

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

request += "<a:KeyValuePairOfstringanyType>";

request += "<b:key>OptionSetName</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:KeyValuePairOfstringanyType>";

request += "<b:key>Value</b:key>";

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

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

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

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

request += "<a:RequestName>InsertOptionValue</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);

}

crm使用soap插入下拉框选项

时间: 2024-12-28 23:15:56

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#代码 //UpdateStateValueRequest updateStateValue = new UpdateStateValueRequest //{ //    AttributeLogicalName = "statecode", //    EntityLogicalName = "new_account_product", //    Value = 1, //    Label = new Label("关闭了", 20

crm使用soap删除下拉框

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

ComboBox连接数据库、显示下拉框选项

?本文从http://blog.csdn.net/susidian/article/details/7027007处学习得来. ?如何将combobox控件绑定数据库,并在下拉框中显示从数据库中查找得到的数据.如何在上一个combobox框中筛选下一个combobox中可以选择的的选项. 贴出代码: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usi

UI自动化之特殊处理二(弹框\下拉框\选项\文件上传)

弹框\下拉框\选项\文件上传也是一些比较特殊的操作 目录 1.弹框 2.下拉框 3.选项 4.文件上传 1.弹框 弹框有三种形式,value为alert.confirm.prompt三种的弹框,第一个仅可点击确认,第二个可点击取消和确认,第三个可以输入内容再点击取消或者确认 alert:仅需要定位到alert上,然后再确认 m= driver.switch_to_alert() m.accept() confirm:定位到alert,点击取消或者确认 m= driver.switch_to_al

selenium (三) 下拉框选项操作

对下拉框操作的方式其实有多种,可以先通过find_elements_by_xpath()获取到下拉框中的所有选项列表,然后在通过list元素进行click()来选择选项(这是我最初实现对下拉框操作的方式),也可以使用selenium自带的方法实现下拉框选项的操作.两者其实差不多,不过,个人觉得还是用find_elements_by_xpath()方式更具有扩展性.因为有些下拉框中的选项中,有可选和不可选的选项时,find_elements_by_xpath()可以通过元素属性过滤掉不可选的选项,

jq select change下拉框选项变化判断选中值,添加(attr)或移除(removeAttr)一个或多个属性

select change下拉框选项变化判断选中值,添加(attr)或移除(removeAttr)一个或多个属性 $("#IsRecommend").change(function () { var isCheck = $(this).children('option:selected').val(); if (isCheck == "true") { $("#CategoryId").css("display", "

关于使用三元运算符来判断下拉框选项是否选中的总结

我们经常会从后台传递一组数据,这一组数据需要放到一个select下拉框中,并且要判断是否要选中其中某一个值 错误的做法是 <select > <option selected="${value.week==1?'selected' :''}>周一</option>" <option selected="${value.week==2?'selected' :''}>周二</option>" <opti