标签:sage DApp title 特性 send crm cat https com
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复207或者20160316可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!
var clientURL = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest() req.open("POST", encodeURI(clientURL + "/api/data/v8.0/WinOpportunity"), true); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function () { if (this.readyState == 4 /* complete */) { req.onreadystatechange = null; if (this.status == 204) { Xrm.Utility.alertDialog("将商机作为赢单关闭成功!"); } else { var error = JSON.parse(this.response).error; Xrm.Utility.alertDialog("将商机作为赢单关闭出错." + error.message); } } }; var requestmsg = {}; requestmsg.Status = 3; requestmsg.OpportunityClose = {}; requestmsg.OpportunityClose.subject = "罗勇结束了这个商机"; requestmsg.OpportunityClose["opportunityid@odata.bind"] = "/opportunities(6025165A-3AA3-E511-80C7-000D3A807EC7)"; req.send(JSON.stringify(requestmsg));
var clientURL = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest() req.open("POST", encodeURI(clientURL + "/api/data/v8.0/teams(E4CC382D-02B9-E511-80DC-000D3A804C3F)/Microsoft.Dynamics.CRM.RemoveMembersTeam"), true); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function () { if (this.readyState == 4 /* complete */) { req.onreadystatechange = null; if (this.status == 204) { Xrm.Utility.alertDialog("将用户移出团队成功!"); } else { var error = JSON.parse(this.response).error; Xrm.Utility.alertDialog("将用户移出团队出错." + error.message); } } }; var requestmsg = {}; requestmsg.Members = []; requestmsg.Members[0] = {}; requestmsg.Members[0].systemuserid = "A576C4B5-44A9-E511-80CF-000D3A806074"; requestmsg.Members[1] = {}; requestmsg.Members[1].systemuserid = "CEFE67E5-44A9-E511-80CF-000D3A806074"; req.send(JSON.stringify(requestmsg));
var clientURL = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest() req.open("POST", encodeURI(clientURL + "/api/data/v8.0/ly_tests(A9B987FB-A4A4-E511-80CC-000D3A80CE7F)/Microsoft.Dynamics.CRM.ly_AddNoteToContact"), true); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function () { if (this.readyState == 4 /* complete */) { req.onreadystatechange = null; if (this.status == 200) { var responseJSON = JSON.parse(this.responseText); Xrm.Utility.alertDialog("注释创建成功,注释ID是" + responseJSON.annotationid); } else { var error = JSON.parse(this.response).error; Xrm.Utility.alertDialog("创建注释出错." + error.message); } } }; var requestmsg = {}; requestmsg.NoteTitle = "这是罗勇通过WEB API创建的注释标题"; requestmsg.NoteText = "这是罗勇通过WEB API创建的注释内容"; req.send(JSON.stringify(requestmsg));
从Dynamics 365 V9版本开始提供了新的客户端API来方便编程,请参考 Xrm.WebApi.online.execute (Client API reference) ,还可以参考我的博文 Dynamics 365 V9版本新的客户端API Xrm.WebApi.online.execute 使用实例 。
更多信息请参考官方文档:Use Web API actions 。
Dynamics CRM 2015/2016新特性之二十四:使用Web API执行操作
标签:sage DApp title 特性 send crm cat https com
原文地址:https://www.cnblogs.com/luoyong0201/p/Dynamics_365_Web_API_Use_Actions.html