function executeWebApiQuery(query, type) {
var result = null;
var clientURL = Xrm.Page.context.getClientUrl();
var req = new XMLHttpRequest()
req.open(type, encodeURI(clientURL + query), false);
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) {
req.onreadystatechange = null;
if (this.status == 200) {
result = JSON.parse(this.response);
}
else {
var error = JSON.parse(this.response).error;
alert("Error : " + error.message);
}
}
};
req.send(null);
return result;
}
var query = "/api/data/v8.1/businessunits(" + BUID + ")?$select=name";
var type = "GET";
var queryResult = executeWebApiQuery(query, type);
if (queryResult.Value.length > 0) {
var BUName = queryResult.Value[0].name;
}
var result = null;
var clientURL = Xrm.Page.context.getClientUrl();
var req = new XMLHttpRequest()
req.open(type, encodeURI(clientURL + query), false);
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) {
req.onreadystatechange = null;
if (this.status == 200) {
result = JSON.parse(this.response);
}
else {
var error = JSON.parse(this.response).error;
alert("Error : " + error.message);
}
}
};
req.send(null);
return result;
}
var query = "/api/data/v8.1/businessunits(" + BUID + ")?$select=name";
var type = "GET";
var queryResult = executeWebApiQuery(query, type);
if (queryResult.Value.length > 0) {
var BUName = queryResult.Value[0].name;
}
Thanks for sharing such an informative post with us. I hope you will share more such post. Please keep sharing.
ReplyDeleteHP Service center in Ameerpet, Hyderabad
Best Laptop Service center in Ameerpet, Hyderabad
MDSU BCOM TimeTable 2020
ReplyDeleteRU BCOM TimeTable 2020
RDVV BCOM TimeTable 2020
Thanks For Sharing!!! Wonderful blog & good post. It is really very helpful to me, waiting for a more new post. Keep Blogging
Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man, Keep it up.mobile phone repair in Novi
ReplyDeleteiphone repair in Novi
cell phone repair in Novi
phone repair in Novi
tablet repair in Novi
ipad repair in Novi
mobile phone repair Novi
iphone repair Novi
cell phone repair Novi
phone repair Novi
Here is the site(bcomexamresult.in) where you get all Bcom Exam Results. This site helps to clear your all query.
ReplyDeleteANDHRA University BCOM 3rd Year Result 2020
BA 3rd year Result 2019-20
Sdsuv University B.COM 3rd/HONOURS Sem Exam Result 2018-2021
Between part them product avoid drug agency. Town help institution each even far. During war business star area million.religious
ReplyDelete