Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How can you get html field in portal page widget

Cindy Sim
Tera Expert

Currently I am able to get plain text fields in widgets. I need to get values entered in description field (HTML) to display in widgets and displayed value should be plain text format . How can I do it ?

1 REPLY 1

Prana Krushna
Giga Guru

@Cindy Sim You have two options
1. You can use "$sp.stripHTML(YOUR_HTML_VALUE); " . This can be done on the server script of the widget.
2. you can use  "$sce.trustAsHtml(YOUR_HTML_VALUE); ". This can be used on the client side script of the widget.
Please check the below screenshot for the uses of the above two with preview.

PranaKrushna_1-1719337788925.png

 



Mark this Helpful if it works for you.