I'm trying to access logical name of the entity referenced by the lookup but for some reason the response doesn't contain Microsoft.Dynamics.CRM.lookuplogicalname property.
sts_origmeeting is a lookup to appointment entity. As appointment can be created from contact/account. i'm trying to access the lookuplogicalname but i don't see this in the response. Please suggest me a solution to access lookuplogicalname.
function TestApp()
{
var serverURL = Xrm.Page.context.getClientUrl();
var origmeetingvalue = window.parent.Xrm.Page.getAttribute("sts_origmeeting").getValue();
var appid = origmeetingvalue[0].id.toString();
appid = appid.replace('{', '');
appid = appid.replace('}', '');
var req = new XMLHttpRequest();
req.open("GET",
Xrm.Page.context.getClientUrl() +
"/api/data/v8.1/appointments(" + appid + ")?$select=_regardingobjectid_value",
false);
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.setRequestHeader("Prefer", "odata.maxpagesize=10");
req.onreadystatechange = function ()
{
if (this.readyState == 4 /* complete */ )
{
req.onreadystatechange = null;
if (this.status == 200)
{
var data = JSON.parse(this.response);
alert(data.value[0]["_regardingobjectid_value@Microsoft.Dynamics.CRM.lookuplogicalname"]);
}
else
{
var error = JSON.parse(this.response).error;
alert(error.message);
}
}
};
req.send();
}
*This post is locked for comments
I have the same question (0)