function demo() {

    //操作记录的id

    var targetId = "a8a46444-ba10-e411-8a04-00155d002f02";

    //操作记录的实体名称

    var targetType = "new_config";

    //启用

    SetState(targetId, targetType, 1, 2);

    //停用

    SetState(targetId, targetType, 0, 1);

}

function SetState(targetId,targetType,state,status) {

    var request = "<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='b:SetStateRequest' xmlns:a='http://schemas.microsoft.com/xrm/2011/Contracts' xmlns:b='http://schemas.microsoft.com/crm/2011/Contracts'>" +

     "<a:Parameters xmlns:c='http://schemas.datacontract.org/2004/07/System.Collections.Generic'>" +

     "<a:KeyValuePairOfstringanyType>" +

     "<c:key>EntityMoniker</c:key>" +

     "<c:value i:type='a:EntityReference'>" +

     "<a:Id>" + targetId + "</a:Id>" +

     "<a:LogicalName>"+ targetType +"</a:LogicalName>" +

     "<a:Name i:nil='true' />" +

     "</c:value>" +

     "</a:KeyValuePairOfstringanyType>" +

     "<a:KeyValuePairOfstringanyType>" +

     "<c:key>State</c:key>" +

     "<c:value i:type='a:OptionSetValue'>" +

     "<a:Value>" + state + "</a:Value>" +

     "</c:value>" +

     "</a:KeyValuePairOfstringanyType>" +

     "<a:KeyValuePairOfstringanyType>" +

     "<c:key>Status</c:key>" +

     "<c:value i:type='a:OptionSetValue'>" +

     "<a:Value>"+ status +"</a:Value>" +

     "</c:value>" +

     "</a:KeyValuePairOfstringanyType>" +

     "</a:Parameters>" +

     "<a:RequestId i:nil='true' />" +

     "<a:RequestName>SetState</a:RequestName>" +

     "</request>" +

     "</Execute>" +

     "</s:Body>";

     "</s:Envelope>";

    

    getWebUrl(request); 

}

//获取服务地址

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

    ajaxRequest.send(request);

}

crm使用soap启用和停用记录的更多相关文章

  1. crm使用soap取消用户訪问记录权限

    //取消訪问权限 function demo() {     //操作记录的id     var targetId = "A8A46444-BA10-E411-8A04-00155D002F ...

  2. 我是如何将网站全站启用Https的?-记录博客安装配置SSL证书全过程

    评论»   文章目录 为什么要Https 如何选择Https 安装部署SSL证书 平滑过渡Https 搜索引擎的响应 启用Https小结 正如大家所看到的,部落全站已经启用了Https访问了,连续几天 ...

  3. MacBook 启用或停用 root 用户

    启用或停用 root 用户 选取苹果菜单 () >“系统偏好设置”,然后点按“用户与群组”(或“帐户”). 点按 ,然后输入管理员名称和密码. 点按“登录选项”. 点按“加入”(或“编辑”). ...

  4. crm使用soap分配记录

    //样例 function demo() {     //操作记录的id     var targetId = "A8A46444-BA10-E411-8A04-00155D002F02&q ...

  5. crm采用soap删除记录

    //抽样 function demo() {     //操作记录id     var targetId = "A8A46444-BA10-E411-8A04-00155D002F02&qu ...

  6. Oracle约束的启用和停用

      关于Oracle的约束概念和基本操作,我已经在以前的<Constraint基础概念>.<Constraint的简单操作>两篇文章中有过比较详细的介绍了,但是对于如何停用和启 ...

  7. Dynamics CRM 通过PowerShell启用AllowDeclarativeWorkflows即自定义XAML WorkFlows

    CRM的工作流即workflow,不了解的人乍听之下以为是审批流,其实不是的,CRM本身是不带审批功能的,要实现审批必须要第三方的工作流引擎的配合,当然你也可以自己开发. 工作流刚开始出现的时候只有异 ...

  8. linux ftp启用和停用及vsftpd安装 ssh 启用和停用命令及ssh的安装

    1.首页要用ftp:服务器上必须安装vsftpd 安装命令 yum installed vsftpd 查看vsftpd是否启动 root@DK:/home/daokr# service vsftpd ...

  9. crm使用soap更改下拉框的文本值

    //C#代码 //UpdateStateValueRequest updateStateValue = new UpdateStateValueRequest //{ //    AttributeL ...

随机推荐

  1. mybatis中打印sql语句

    在mybatis-config.xml中properties节点下,配置一个settings节点 <settings> <setting name="cacheEnable ...

  2. MVC系列学习(三)-EF的延迟加载

    1.什么叫延迟加载 字面上可以理解为,一个动作本该立即执行的动作,没有立即执行 2.从代码上理解 static void Main(string[] args) { //执行该语句的时候,查看sql监 ...

  3. centos7下手动制作trove镜像

    获取镜像 [root@bldattet1 ~]#  wget http://mirrors.aliyun.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64 ...

  4. SQL基本操作——GROUP BY

    GROUP BY 语句用于结合合计函数,根据一个或多个列对结果集进行分组. SQL GROUP BY 实例:我们拥有下面这个 "Orders" 表 O_Id OrderDate O ...

  5. C# WinForm窗体应用(第四天)

    一.点击登录按钮,将两个窗体进行连接,并进行用户名和密码验证. /// <summary> /// 登录设置 /// </summary> /// <param name ...

  6. (原创)HyperPacer使用技巧之集合点设置

    版权声明:本文为原创文章,转载请先联系并标明出处 性能测试中,我们可以模拟最真实的用户操作来建立性能模型,但是这种模拟是相对的.譬如12306网站春运开始后每一天都是高峰,这种高负载情况会持续一至两个 ...

  7. 2015.12.25-2016.01.01 大论文迭代B

    大论文B轮迭代,稍重前端 12.25 周五,完善摘要 12.26 周六,完善第一章 12.27 周天,完善第二章 12.28 周一,完善第三章 12.29 周二,完善第四章 12.30 周三,完善第五 ...

  8. ( 转)Hibernate常用API

    http://blog.csdn.net/yerenyuan_pku/article/details/65103203 可在度娘上摘抄如下文字: Hibernate的核心类和接口一共有6个,分别为:S ...

  9. mysql_数据查询_嵌套查询

    嵌套查询 一个SELECT-FROM-WHERE语句称为一个查询块. 嵌套查询:将一个查询块嵌套在另一个查询块的WHERE子句或者HAVING短语的条件中的查询. 注:子查询的SELECT语句中不能使 ...

  10. Linux cat 命令

    cat命令是linux下的一个文本输出命令,通常是用于观看某个文件的内容的:cat主要有三大功能:1.一次显示整个文件.$ cat   filename2.从键盘创建一个文件.$ cat  >  ...