Hi,
I think gridEntity is different from your regular entity - you can't get just any attribute:
msdn.microsoft.com/.../dn932126.aspx
You can use GridEntity to get the id, and, then, you'll need to use WebAPI to retrieve contact into.. somethind like this:
function getContact(id) {
var contactId = id.replace(/\{|\}/gi, "");
var clientURL = Xrm.Page.context.getClientUrl();
var req = new XMLHttpRequest();
var query = "/api/data/v8.2/contacts("+contactId+")";
req.open("GET", encodeURI(clientURL + query), true);
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 () {
debugger;
if (this.readyState == 4) {
req.onreadystatechange = null;
if (this.status == 200) {
var contact = JSON.parse(this.response);
alert(contact.telephone1);
}
else {
var error = JSON.parse(this.response).error;
alert("Error retrieving Record – " + error.message);
}
}
};
req.send();
}
}