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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Showing picture(entityimage) into CRM Online Report

Zohaib Uddin Khan Profile Picture Zohaib Uddin Khan 2,822

Author: Zohaib Uddin Khan

Credit: For this tip & trick, thanks to Andrew Butenko

I need to prepare a CRM Online report which shows the picture of the ‘Contact’ or any other entity. The schema name for the picture attribute is ‘EntityImage’. Since I’m preparing the report for the CRM Online, so I can only use FetchXML. I used the ‘EntityImage’ attribute in the FetchXML as I used other attributes but a picture is not appearing. Further analyzing the ‘EntityImage’, I noticed that it is only returning the string data while I was expecting binary data into it.

At this point, I posted my question to the ‘Dynamic CRM’ community and Andrew Butenko provided a solution to handle this case.

Solution:

  • Create a new ‘Multiple Lines of Text’ attribute. (Make sure the maximum length)

EntityImage-CRM-Online-Report-1

  • Write an Update Plugin on the Contact entity, which will store the value in Base64. No need to write a Create plugin as a picture can only be set after the creation of the record. Following one line will convert the data of ‘EntityImage’ into ‘Base64’ string.

entity[“cewa_entityimagebase64”] = Convert.ToBase64String((byte[])entity[“entityimage”]);

  • Now, open the Report, place the image placeholder and set the values accordingly. The following line of code will do the trick.

System.Convert.FromBase64String(Fields!cewa_entityimagebase64.Value)

EntityImage-CRM-Online-Report-2

After browsing the report, you can see image started appearing in the CRM Online Report.

EntityImage-CRM-Online-Report-3.png



This was originally posted here.

Comments

*This post is locked for comments