在前端JS中 call web api
2021-01-12 13:32
标签:hang var type lse build change function == cat 前端写Web API 已经不是什么特别困难的问题, 我们可以使用 CRM REST Builder(https://github.com/jlattimer/CRMRESTBuilder)来生成想使用的 CRM REST Builder 在前端JS中 call web api 标签:hang var type lse build change function == cat 原文地址:https://www.cnblogs.com/TheMiao/p/12289210.htmlvar req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/accounts(" + parent.Xrm.Page.data.entity.getId().replace(‘{‘, ‘‘).replace(‘}‘, ‘‘) + ")?$select=accountid,address1_addressid", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var result = JSON.parse(this.response);
var accountid = result["accountid"];
var address1_addressid = result["address1_addressid"];
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();
上一篇:win10下载软件防止被杀
文章标题:在前端JS中 call web api
文章链接:http://soscw.com/index.php/essay/41409.html