zoukankan      html  css  js  c++  java
  • crm使用soap更改下拉框的文本值

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

     

  • 相关阅读:
    scikit-image 库简介
    如何下载网易云音乐APP里的MV和短视频?
    CentOS上用Squid搭建HTTP代理小结
    超简单的晃咖、小咖秀视频去水印下载方法
    自媒体攻略合集,教你如何做一名能赚钱的自媒体人
    怎么下载映客的视频?映客小视频下载到本地的方法
    如何把手机app的视频下载到手机上?网页上的视频怎么下载?
    短视频如何制作?如何下载短视频?常用的短视频录制和剪辑App有哪些?
    JVM jinfo命令(Java Configuration Info) 用法小结
    iOS11有哪些新功能?旧iPhone是否真的变慢了
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/4074748.html
Copyright © 2011-2022 走看看