//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. Android应用程序注冊广播接收器(registerReceiver)的过程分析

    前面我们介绍了Android系统的广播机制,从本质来说,它是一种消息订阅/公布机制,因此,使用这样的消息驱动模型的第一步便是订阅消息:而对Android应用程序来说,订阅消息事实上就是注冊广播接收器, ...

  2. iOS之Swift语言的学习

    好久都没有来这个熟悉而又陌生的地方啦, 想想已经有两三个月了吧,不过我相信以后还是会经常来的啦,因为忙碌的学习已经过去啦,剩下的就是要好好的总结好好的复习了,好好的熟悉下我们之前学习的知识点,将他们有 ...

  3. openssl ans.1编码规则分析及证书密钥编码方式

    1 数据编码格式 openssl的数据编码规则是基于ans.1的,ans.1是什么 ? 先上高大上的解释 ASN.1(Abstract Syntax Notation One), 是一种结构化的描述语 ...

  4. CSS减肥的工具–Firefox插件 CSS Usage

    首先,我们需要安装Firefox(猛击此处下载),或者确定你已经安装的版本已经高于3.1; 第二步,安装前端开发人员最普及的开发工具 Firebug: 第三步,安装CSS Usage 0.3.4.1: ...

  5. Log4net 列

    配置 <configuration> <configSections> <section name="log4net" type="Syst ...

  6. .net 地址栏传中文乱码 的解决方法

    1.设置web.config文件. <system.web> ...... <globalization requestEncoding="gb2312" res ...

  7. (原)ubuntu16在torch中使用caffe训练好的模型

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5783006.html 之前使用的是torch,由于其他人在caffe上面预训练了inception模型 ...

  8. Mac OS X和iOS上基本数据类型的字节数

    在Mac和IPhone上分别运行下面的程序: NSLog(@"char size = %lu", sizeof(char)); NSLog(@"short int siz ...

  9. maven配置spring mvc+hibernate+spring框架

    作为一名刚出茅草屋的新手小白写的框架,仅适合新手小白借鉴,大神勿喷,谢谢...... 前天刚知道spring mvc这个框架现在也很流行,决定用它代替struts2来写我的毕业设计. ...作为一名新 ...

  10. MySql存储引擎介绍

    MySQL5.5以后默认使用InnoDB存储引擎,其中InnoDB和BDB提供事务安全表,其它存储引擎都是非事务安全表.若要修改默认引擎,可以修改配置文件中的default-storage-engin ...