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插入下拉框选项的更多相关文章
- crm使用soap更改下拉框的文本值
//C#代码 //UpdateStateValueRequest updateStateValue = new UpdateStateValueRequest //{ // AttributeL ...
- crm使用soap创建下拉框
//C#代码 //#region OptionMetadataCollection //OptionMetadataCollection opCollection = new OptionMetada ...
- crm使用soap删除下拉框
//C# 代码: //DeleteOptionSetRequest request = new DeleteOptionSetRequest(); //request.Name = "new ...
- 大型情感剧集Selenium:4_老中医教你(单/多/下拉框)选项定位 #华为云·寻找黑马程序员#
今天讲什么 讲什么标题说了,讲selenium的单选.多选.下拉框选项定位.但其实这东西,没什么太多说的,又比较枯燥,那该怎么让这一集selenium的课程变得有趣呢?有请老中医,哈哈- 怎么样,这个 ...
- jq select change下拉框选项变化判断选中值,添加(attr)或移除(removeAttr)一个或多个属性
select change下拉框选项变化判断选中值,添加(attr)或移除(removeAttr)一个或多个属性 $("#IsRecommend").change(function ...
- UI自动化之特殊处理二(弹框\下拉框\选项\文件上传)
弹框\下拉框\选项\文件上传也是一些比较特殊的操作 目录 1.弹框 2.下拉框 3.选项 4.文件上传 1.弹框 弹框有三种形式,value为alert.confirm.prompt三种的弹框,第一个 ...
- jQuery 动态加载下拉框选项(Django)
function change_style() { $.ajax({ url: "{% url 'change_style' %}", type: "GET", ...
- 巧妙解决element-ui下拉框选项过多的问题
1. 场景描述 不知道你有没有这样的经历,下拉框的选项很多,上万个选项甚至更多,这个时候如果全部把数据放到下拉框中渲染出来,浏览器会卡死,体验会特别不好 用人会说element-ui的select有一 ...
- JavaScript操作select下拉框选项移动
运行结果: 源代码: 1 <!DOCTYPE html> 2 <html lang="zh"> 3 <head> 4 <meta char ...
随机推荐
- Core 1.0中的管道-中间件模式
ASP.NET Core 1.0中的管道-中间件模式 SP.NET Core 1.0借鉴了Katana项目的管道设计(Pipeline).日志记录.用户认证.MVC等模块都以中间件(Middlewar ...
- HDU 2504 又见GCD
又见GCD Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...
- Leetcode 3Sum Closet
二手和3Sum像几乎相同的想法.二进制搜索.关键修剪.但是,在修剪做出很多错误. 然后还有一个更加速了原来的想法O(n^2). #include<iostream> #include &l ...
- Mac下使用MySQL
0 安装 http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.17-osx10.7-x86.dmg http://dev.mysql.com/down ...
- Test SRM Level One: TemperatureScales
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=6038 因为TopCoder SRM比赛使用的编译器进行了升级, ...
- 性能是全新的 SEO
作为一个前端project师,那不只就是公开地处理那些美丽的html5, css3 和javascript特效.小而重要的一部分工作就是要让项目朝着代码稳定和代码标准方向进展.设计.信息结构以及后台限 ...
- 动态创建ImageView
1.布局文件 <LinearLayout android:id="@+id/viewGroup" android:layout_width="wrap_conten ...
- ExternalInterface的简单使用方法
ExternalInterface的简单使用方法 使用ExternalInterface调用JavaScript方法-无返回值flex代码------------------<mx:Button ...
- 于Unity3D动态创建对象和创建Prefab三种方式的原型对象
于Unity3D动态创建对象和创建Prefab三种方式的原型对象 u3d在动态创建的对象,需要使用prefab 和创建时 MonoBehaviour.Instantiate( GameObject o ...
- FTP文件操作之上传文件
上传文件是一个比较常用的功能,前段时间就做了一个上传图片的模块.开始采用的是共享文件夹的方式,后来发现这种方法不太好.于是果断将其毙掉,后来选择采用FTP的方式进行上传.个人感觉FTP的方式还是比较好 ...