Description Field (String) displaying HTML tags

Derek3
Kilo Expert

When users are copying and pasting data from somewhere that is rendering HTML, ServiceNow is keeping the tags and displaying them, both on the screen and on emails sent out from the OTB emails.

Support have confirmed this as expected behavior, while kindly providing a solution of changing the field to HTML.     We really do not want to do this however for various reasons.

Has anyone ever come across this before or do they know of a fix we can implement to stop the tags being displayed?

Thanks

Derek

1 ACCEPTED SOLUTION

Try to use the below code on change of the description field.



var des = g_form.getValue('description');
var actualdes = des.replace(/<(?:.|\n)*?>/gm, '');


g_form.setValue('description',actualdes);


View solution in original post

9 REPLIES 9

Subhajit1
Giga Guru

The Description Field is Simple Text and if HTML rendered data is copied, the data along with the tags will be copied as is. These field types does not have to capability to distinguish between HTML tags and free text.


What Service-Now support have suggested is the way to go forward, IMO.


Try to use the below code on change of the description field.



var des = g_form.getValue('description');
var actualdes = des.replace(/<(?:.|\n)*?>/gm, '');


g_form.setValue('description',actualdes);


Thanks that worked!


Please mark the solution as corerct,, which will help other:)