RE: How to find the owning business unit's field id of an case during the onload event using in javascript
var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/contactSet?$select=OwningBusinessUnit", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState === 4) {
this.onreadystatechange = null;
if (this.status === 200) {
var returned = JSON.parse(this.responseText).d;
var results = returned.results;
for (var i = 0; i < results.length; i++) {
var owningBusinessUnit = results[i].OwningBusinessUnit;
}
}
else {
alert(this.statusText);
}
}
};
req.send();
output
{
OwningBusinessUnit:{
Id:"000043cf-0caf-0000-0000-0000000c6c10",
LogicalName:"businessunit",
Name: null
}
},
If my response is helps you, please mark as "Verified"