Hi Justin
Thanks so much for your response. It was really so easy to use the Web API.
This script worked perfectly for me..
function PopulateEntityImageBase64() {
debugger;
var isCreateForm = Xrm.Page.ui.getFormType() == 1;
if (!isCreateForm) {
var serverURL = Xrm.Page.context.getClientUrl();
var queryEntity = "ks_portfolios";
var Guid = Xrm.Page.data.entity.getId();
var selectOptions = "$select=entityimage";
var req = new XMLHttpRequest();
req.open("GET", encodeURI(serverURL + "/api/data/v8.2/" + queryEntity + "(" + Guid + ")?" + selectOptions), 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 entityimage = result["entityimage"];
Xrm.Page.getAttribute('new_entityimagebase64').setValue(entityimage);
}
else {
}
}
};
req.send();
}
}
Really so easy with JS and the Web API.
Thanks again!