//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. MapReduce源代码浅析

    Thanks @读程序的手艺人 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHVvemhhbmZlbmc=/font/5a6L5L2T/fontsize ...

  2. Swift学习之类和结构体的创建

    随着一步步的学习,学习到的新知识越来越多了,不管是新的还是旧的,都禁不住时间的堆积,再熟悉的知识点时间久了都会渐渐的忘记,也许这就是人们生活中一种潜在的惰性吧,看似非常熟悉的东西,等到真正要用的时候, ...

  3. XMLHttpResponse 在项目里面的运用

    前些天在项目里面遇到了一个问题,项目的列表页面每条记录后面都有按钮做审核操作,但是这个操作并不需要引起弹窗,只需要到后台修改一下这条记录的一些状态值,但是操作执行之后却没有刷新页面,只有重新载入或者刷 ...

  4. Table表格的一些操作

    首先创建一个table表格: <input type="button" id="btn1" value="获取数据" /> &l ...

  5. JS正则表达式收集篇

    1.验证只可输入整数或小数点后两位的数字:/^([1-9]{1}|[1-9]{1}[0-9])+(.[1-9]{1,2})?$/ 2.验证Email: /^([a-zA-Z0-9]+[_|\_|\.] ...

  6. 高逼格的实现WiFi共享,不安装第三方wifi共享软件,两种方式实现开启wifi的功能

    作为一枚程序员,不会点高逼格的doc命令,那么都有点感觉对不起自己的行业了,好了废话就到这里了   第一种方式: 首先使用cmd命令:window键+R 然后输入cmd回车 第一种方式: 第一步: 设 ...

  7. java 加载图片的几种方式

    项目目录--src--testTable--image--active.gif | |_Task.class 方法1:通过项目目录访问. String a = System.getProperty(& ...

  8. UIAlertController(警告栏) 自学之初体验

    UIAlertController有两种样式  preferredStyle: UIAlertControllerStyleAlert (位于屏幕的中部) UIAlertControllerStyle ...

  9. Servlet开发(二)

    一.ServletConfig讲解 1.1.配置Servlet初始化参数 在Servlet的配置文件web.xml中,可以使用一个或多个<init-param>标签为servlet配置一些 ...

  10. git merge 分支

    把master merge到apple_campus1.git stash2.git checkout master3.git pull4.git checkout apple_campus5.git ...