How to display a HTML field on a form widget

Lisa Silvaroli
Tera Guru

I am trying to get a HTML field to be displayed on a custom version of the Approval Record. 

I have tried the following but cannot seem to get it right:

HTML:

 <div ng-bind-html="::data.u_approval_instruction"></div>

Clint Script:

function($scope, $sce) {
   /* widget controller */
   var c = this;
// Display HTML field
	
$scope.data.u_approval_instruction = $sce.trustAsHtml($scope.data.u_approval_instruction);
}

Server Script:

data.u_approval_instruction = task.u_approval_instructions;

 

I either get the following or nothing at all

find_real_file.png

Any suggestions? 

1 ACCEPTED SOLUTION

Hi,

Can you please post screen shot or more lines where you have added this line in server script?

doing below might fix it

data.u_approval_instruction = task.u_approval_instructions + "";

i added extra  + "" part which will convert it to javascript string.

 

data.u_approval_instruction = task.u_approval_instructions;

View solution in original post

6 REPLIES 6

Great!! Best practice is to either use getDisplayValue() or convert it to string using "" .

Hello,

 

Thanks for sharing this solution.

For me it works fine when text is bold or in italic, but when i use a color, color doesn't display on ServicePortal.

Do you have any idea how can I achieve that ?

 

Kinds regards,