HTML field not rendering in portal widget

Steve McGrath
Tera Contributor

Hi,

We recently modified our Incident form description field to html. This is working well in the platform, however, our portal description now displays the html code when viewing the ticket form. The widget "ticket fields updated" only renders plain text. I'm not sure how to get the widget to display correctly. Any help or guidance is very much appreciated.

find_real_file.png

 

find_real_file.png

 

1 ACCEPTED SOLUTION

Oleg
Mega Sage

It's not enough to modify the Server Script by including the name of HTML field ("u_description_2" in your case) in the list of displayed fields:

var fields = $sp.getFields(gr, 'number,state,short_description,u_description_2,sys_created_on,watch_list');

You have to modify the Body HTML Template of the widget by including the line like the following

<sp-html-content ng-switch-when="html" model="::field.value" />

near the line number 23.

The corresponding fragment of HTML code will look:

<dd class= "col-md-6 col-sm-12 col-xs-6 break-word" 
	ng-repeat-end ng-switch="field.type" 
	ng-if="field.value && (field.type != 'decimal' || field.type == 'decimal' && field.value != 0)">
  <sp-html-content ng-switch-when="html" model="::field.value" />
  <div ng-switch-when="glide_date_time" title="{{field.display_value}}">
	<sn-time-ago timestamp="::field.value" />
  </div>
  <div ng-switch-default >{{field.display_value}}</div>
</dd>

View solution in original post

7 REPLIES 7

Subhajit Majumd
Giga Contributor

Hi Steve

 

Below is a sample screenshot for binding HTML contents bought over from Server side.

If that specific html field can be used in expression in the ng-bind-html attribute, hopefully it should work.

 

find_real_file.png

 

Thanks

Subhajit Majumder

If this helps, please mark helpful.

This worked for me

<div ng-if="task.text"><br>
<ng-bind-html ng-bind-html="task.text.display_value"></ng-bind-html></div>

Hi Subhajit,

I would like to add the description field into the service portal and i am not finding the exact page to put in the code.

Could you please guide.

I go to service portal configuration--> from here i dont know where to navigate.

I would want to add description field.find_real_file.png

 

 

Thank you! It is useful for me.