//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. linux下安装swftools工具

    swfTools是一种实用工具与Adobe Flash文件(swf文件)工作的集合.可以把(pdf/gif/png/jpeg/jpg/font/wav) 7种格式转换为swf文件.一般常用于文件在线浏 ...

  2. java编程中的Java.Lang.Math类

    1. Math.PI  :表示的是圆周率常量: 2.Math.E    :表示的是普通常量(e): 3.abs()方法: 表示取绝对值 eg1: int x = Math.abs(50L);     ...

  3. overflow清楚浮动 + 去掉li标签的小圆点

    原文链接:http://blog.163.com/qqabc20082006@126/blog/static/22928525201031211212955/ 测试用例: <!DOCTYPE h ...

  4. No redirect found in host configuration file (C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet.config).

    Configuration Error Description: An error occurred during the processing of a configuration file req ...

  5. 指针参数的传递(节选 C++/C 高质量编程 林锐)

    指针参数是如何传递内存的 如果函数的参数是一个指针,不要指望用该指针去申请动态内存.示例7-4-1中,Test函数的语句GetMemory(str, 200)并没有使str获得期望的内存,str依旧是 ...

  6. boost vc编译

    0.下载:http://www.boost.org/ 1.编译b2.exe,bjam.exe. 双击根目录下面的bootstrap.bat文件,生成b2.exe,bjam.exe(或者使用vs的命令行 ...

  7. OpenSSl编译

    1.下载openssl代码,下载地址:http://www.openssl.org/source/ ,如果使用winrar解压失败的话(提示不能创建符号链接),可以关闭UAC.2.下载安装Active ...

  8. Mysql 配置慢查询日志(SlowQueryLog)以及使用日志分析工具

    [ 查看系统关于慢查询的设置 ] mysql> show variables like '%slow%'; +---------------------------+-------------- ...

  9. collections——高性能容器数据类型

    由于最近对机器学习算法感兴趣,一直知道python有一个包collections封装了一些比dict,list之类高级点的类,所以抽空研究下,为接下来的工作准备. 主要参考是https://docs. ...

  10. Advanced Fruits(HDU 1503 LCS变形)

    Advanced Fruits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...