web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Retrieve Base64 Value of EntityImage

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello Tony,

    I'm afraid  you will have to use .Net and plugins.

  • Verified answer
    Justinjose Profile Picture
    2,707 on at

    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

  • Community Member Profile Picture
    on at

    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!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans