HTML code is visible on the notification while using description field in HR case

Vijay Anusuri
Tera Contributor

HTML code is visible on the notification while using description filed on the HR case.

If I use rich_description it's working as expected, but this is working earlier while using description field

Can anyone suggest the issue over here.

Thanks in Advance.

2 REPLIES 2

Nilesh Pol
Tera Guru

@Vijay Anusuri The description field is a plain text field (String), not an HTML field. When you put HTML-like content inside it, it’s treated literally in the notification.

It might be because of ServiceNow instance upgrade changed how rendering is handled, especially around safe HTML sanitization and field types.

 

Recommended to use rich_description 

OR

Convert description to HTML safely with below script in email script:

var desc = current.description + '';
return desc.replace(/\n/g, '<br>');

 

if my response helps you, then please hit helpful and accept as a solution.

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Vijay Anusuri 

description field is of what type? May be it's string and hence showing HTML code in notification

It's working for rich_description because it's HTML type.

Since you said it was working previously.

Did you upgrade recently?

Did the field type change during the upgrade?

share some more details and screenshots.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader