top of page

T#4 Adding EntityImage to D365 portal

Is it possible to access in a simple way, any Dynamics 365 EntityImage?

Is it possible to show the requested image from within the Portal?

Let's suppose that we need to show for a certain portal user the logo of the account he belongs to.

3 steps to follow:

1. Adding Entity Permissions:

Go to Settings -> Portals -> Entity Permissions

Click on New and create a new Entity permission towards the parent account of the contact

Remember to fill out the following infos:

  • EntityName: The entity that contains the image to show on your portal

  • Website: Your portal website

  • Scope: Contact - This allows you to show the image of the account related to the loged in contact via the portal.

  • ContactRelationship: Relationship between the User (contact) logged in into your portal and the entity that contains the image.

  • Priviledges: A read as a minimum

Note down the relationship technical name that we will be using later on. In our example it is : "contact_customer_accounts".

Once this is done, Save the info and scroll down to add the corresponding Webroles.

I added the "Authenticated Users" web role in this example since I just need to show the Account's Image of the authenticated contacts logged In via our portal.

2. Modifying the Portal Web Template:

Go to Settings -> Portals -> Web Templates

Choose the Web Template corresponding to your Portal Page:

Then, in the source section, add the following code:

What's in this code?

{% assign acct = user.contact_customer_accounts %} // Retrieving the parent account of the user.

{% if acct %} //In case the contact has an account

<img src="{{acct.entityimage_url}}" alt="image" height="50" width="50"> //The first part of the URL is static and corresponds to the Dynamics URL, the second part is dynamic and contains the sub_url of the default crm field referring to the image. The image will be resized depending on the height and width you precise. "image" is the alternative text that will be shown in case there is a problem showing up the image.

{% else %}

Please upload your image //Alternative text in case the contact doesn't have a parent account.

{% endif %}

3. Save and check the result:

After saving your web template, verify that it is chosen by the corresponding page inside your portal, otherwise the results will not be shown.

Wait a few seconds then refresh your portal page.

341 views0 comments

Recent Posts

See All
bottom of page