{Quick Tip} Need to show entity image in your webresource? Think of using entityimage_url and not image content.

I was bit hesitant to write this blog to be honest as I thought it’s pretty mundane and must be quite known to everyone. And we had the same requirement for the customer. They wanted to show the entity image of a contact in a webresource.

The functionality as already implemented and I was just reviewing the code. However when I checked the code, I found there is quite a bit written to show the image.

  • The entityimage field of the account is queried to get the content
  • The whole content is then set using <image src=’data:image/png;base64,<content>’ />

Surprising it is but when I told them there is a better way to do it without querying the content and all, many seemed unware of it. Hence I thought this would be of help to someone faced with similar situation.

For entity image field, there is a separate field created called – “entityimage_url” which can be queried as well. Below is the WebAPI query to get the entity image of an account. Same can be used with any other entity.

https://powerappsforyou2020.crm.dynamics.com/api/data/v9.0/accounts(936B419F-9F4B-E111-BB8D-00155D03A715)?$select=entityimage_url

image

The final step is to set the image url in the src attribute of the image in webresource. And you can see it in your web resource.

image

Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Author: Debajit

I am a Dynamics CRM Most Valuable Professional (MVP) with 12 years of experience in Microsoft .NET Technologies and 9 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s