Skip to main content

Notifications

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

  • Community Member Profile Picture
    on at
    RE: Retrieve Base64 Value of EntityImage

    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!

  • Verified answer
    Justinjose Profile Picture
    2,707 on at
    RE: Retrieve Base64 Value of EntityImage

    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

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Retrieve Base64 Value of EntityImage

    Hello Tony,

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

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 54

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans