Rich Text Field like email description are showing in plain text with html tags in PowerApps/ Dynamics 365 Portals

This one is quite interesting. So my customer was showing the timeline on the portal. So emails, appointments and phone calls we being shown in portal timeline. The problem with timeline in portals is when too many of them are there, it becomes a clutter. So our customer wanted to have separate form dedicated for emails where they could read the complete email description.

No worries right, we can just expose an entity form for email with appropriate entity permissions. All set and done and when the user tries to open the email in the portal, it does not turn out to be as expected in the portal.

Advertisements
image

You can see the description field of the email being shown in plain text. All the rich text that you can see nicely formatted in Dynamics 365, is no where to be seen in the portals.

There is an easy fix for this. All you need is to create a site setting – “DisableValidationWebTemplate” and set it to true.

Request validation won’t take place and rich text shall be saved and retrieved as rich text. If you are from ASP.NET Programming background, you know request validation exists for a reason and the security reasons for it there to exist. You can google on this topic and find more. However we are not going to do it.

Advertisements

More over in our case, we just needed to show the email as readonly. If that is a requirement for you as well, all you need to do is to place a simple javascript on load of your entity form.

$(window).load(function() {

$(“#description”).parent().append(“<span class=’text’>” + $(“#description”).val()+ “</span>”);

$(“#description”).remove();

});

What we are doing here is hiding the default textarea control and instead rendering the content inside a span element. You can even use a div element to render the HTML.

After I refresh the portal cache, below is how it looks. Wonderful isn’t it? And that too with a small tweak.

Advertisements
image

Hope this helps!

Debajit Dutta

(Business solutions MVP)

Leave a Reply