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

}

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

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

    http://www.cnblogs.com/djgs/p/3691979.html?utm_source=tuicool&utm_medium=referral 现在有一个Id为AreaId ...

  2. python webdriver中对不同下拉框通过文本值的选择

    在自动化中python对下拉框的处理网上相对实例比较少,其它前辈写的教程中对下拉也仅仅是相对与教程来说的,比如下面: m=driver.find_element_by_id("Shippin ...

  3. crm使用soap创建下拉框

    //C#代码 //#region OptionMetadataCollection //OptionMetadataCollection opCollection = new OptionMetada ...

  4. crm使用soap插入下拉框选项

    //C# 代码: //InsertOptionValueRequest request = new InsertOptionValueRequest(); //request.OptionSetNam ...

  5. crm使用soap删除下拉框

    //C# 代码: //DeleteOptionSetRequest request = new DeleteOptionSetRequest(); //request.Name = "new ...

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

    easyui的combobox下拉框默认初始值是空,下面是实现从远程加载数据之后初始化默认值,以及让该值一直排在下拉框的最顶部的方式. 目前的需求是需要在初始化的时候添加"全部数据库&quo ...

  7. js 设置下拉框的默认值

    设置下拉框的默认值,直接在option中增加selected就可以了.但是现在要使用JS来设置它的默认值,代码如下: <select name="aaa" id=" ...

  8. Selenium常用API用法示例集----下拉框、文本域及富文本框、弹窗、JS、frame、文件上传和下载

    元素识别方法.一组元素定位.鼠标操作.多窗口处理.下拉框.文本域及富文本框.弹窗.JS.frame.文件上传和下载 元素识别方法: driver.find_element_by_id() driver ...

  9. jQuery操作下拉框的text值和val值

    jQuery操作下拉框的text值和val值 1,JS源码 <select name="select1" id="select1" style=" ...

随机推荐

  1. 同一个页面多个CALayer重绘的办法

    //知识点,CALayer的重绘,-(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx 方法,CALayer的渐变色.多个CALa ...

  2. 触摸点为scrollview上的子控件时,scrollview不能滚动(iOS8)

    现象:在iOS8上,scrollview上面布局了多行多列的button,滑动scrollview,如果当触摸点是在按钮上,scrollview不能滚动. 例如: 解决方法:设置scrollview的 ...

  3. CLR via C# - 基础拾遗

    编译器开关设置 IL代码质量 JIT本地代码质量 /optimize- /debug-(默认设置) 未优化 优化 /optimize- /debug+(full/pdbonly) 未优化 未优化 /o ...

  4. Java IO5:管道流、对象流

    前言 前面的文章主要讲了文件字符输入流FileWriter.文件字符输出流FileReader.文件字节输出流FileOutputStream.文件字节输入流FileInputStream,这些都是常 ...

  5. 9、Khala实现0.01版QQ

    这次来个有界面的. 登录界面: 主界面: 1.服务端开发: 只需创建一个类ChatType(./examples/HelloKhala/src/ChatType.cpp),在该类型中,核心为创建的两个 ...

  6. NopCommerce 3.3中文语言包发布下载及使用

    NopCommerce 3.3是一套国外优秀的开源电子商务项目,其拥有完整的电子商务功能且具有灵活的配置功能,基于微软最新技术ASP.NET MVC 5.1.1,EntityFramework.6.1 ...

  7. Firebug介绍及使用技巧

    一.介绍 Firebug是网页浏览器Firefox下的一款开发调试工具.安装firebug后在浏览器的插件工具栏中(上方)会有一个小甲虫的图标. F12打开和关闭Firebug窗口. 二.FireBu ...

  8. 正确看待HTML5的语法变化

    也许会有人问:“HTML4已经很普及了,如果改变基础语法,会不会有什么影响?” 我们都知道,在HMTL5之前几乎没有符合标准规范的Webu浏览器!在这种情况下,各个浏览器之间的互相兼容性和互操作性在很 ...

  9. <Programming Collective Intelligence> Chapter2:Making Recommendations

    <Programming Collective Intelligence> Chapter2:Making Recommendations 欧几里得距离评价 皮尔逊相关度评价 它相比于欧几 ...

  10. django中使用json.dumps处理数据时,在前台遇到字符转义的问题

    django后台代码: import json ctx['dormitory_list'] = json.dumps([{", "is_checked": 1}, {&q ...