Hi
I would like to use the entityimage of a custom entity in an SSRS report.
As far as understand, I need to create a multi-line text box and retrieve the Base64 values of the entity image and use this value in my SSRS report.
I do not want to write a plug-in to retrieve the Base64 value and would prefer to do this with JavaScript or a workflow rule.
Does anyone have any suggestions on the JavaScript that may be able to copy the Base64 value of the entityimage and populate a multi-line text box?
Thanks
Tony
*This post is locked for comments
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!
Hi Tony,
I am not sure this is what you looking for. You can get entity image Base64 using Web Api Java Script. Below the result what i got
@odata.context:"https://m365x324343.crm11.dynamics.com/api/data/v8.2/$metadata#", value:[ { @odata.etag:"W/"1153013"", createdon@OData.Community.Display.V1.FormattedValue:"5/31/2018 3:45 PM", createdon:"2018-05-31T15:45:12Z", importsequencenumber: null , entityimageid: null , utcconversiontimezonecode: null , entityimage_timestamp: null , entityimage_url: null , _owningteam_value: null , _modifiedonbehalfby_value: null , _createdonbehalfby_value: null , timezoneruleversionnumber: null , entityimage: null , } ]
Thanks
Justin Jose
Hello Tony,
I'm afraid you will have to use .Net and plugins.
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6