hello everyone,
i try to get the parent Account from a Contact in the Phone call entity (call to).
this is my code the problem that i dont know how i can come back the result . i need the (parentcustomerid_value_formatted us return)
var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() "/api/data/v9.1/contacts(b3859a95-1a0a-ea11-a811-000d3ab200b5)?$select=_parentcustomerid_value", 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 _parentcustomerid_value = result["_parentcustomerid_value"];
var _parentcustomerid_value_formatted = result["_parentcustomerid_value@OData.Community.Display.V1.FormattedValue"];
var _parentcustomerid_value_lookuplogicalname = result["_parentcustomerid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
return _parentcustomerid_value_formatted;
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();