how to remove html codes in the Description field

swathib
Mega Contributor

Hi All,

we scroll down within a ticket, html codes in the Description field under the "Incidents by Same Caller" tab are visible.  

HTML codes were not visible in Eureka.Please see the below screen shot.

Can anyone help me how to remove the html tags in Description field

find_real_file.png

1 ACCEPTED SOLUTION

Check if the below property is there in sys_properties "glide.ui.escape_html_list_field".


Mark it to false.



Note : It is in global scope so it would not be for specific table.



Thanks,


Akhil


View solution in original post

18 REPLIES 18

WHOA!!! Be careful, I tried this method in  my own instance, and when I set the property back to 'true' all the descriptions were blank in the list view - just saying.....

Abhishek Raj3
Tera Guru

Hi Swathi,



Please go through this link it will help you to sortout your issue.



HTML Sanitizer - ServiceNow Wiki



If the glide.html.sanitize_all_fields property is true, as it is by default for new instances starting with Eureka, the HTML sanitizer is enabled for all HTML fields.


Alternatively, administrators can set the glide.html.sanitize_all_fields property to false, and then disable and enable HTML sanitizer on a per-field basis in individual forms.


  1. Navigate to the form that contains the HTML field.
  2. Right-click the HTML field header, and select Configure Dictonary (Personalize Dictionary in versions prior to Fuji).
    The Dictionary Entry form opens for the HTML field.
  3. Enter one of the following in the Attributes field:
    • To disable sanitization enter html_sanitize=false
    • To enable sanitization enter html_sanitize=true
  4. Click Update.

To enable the HTML sanitizer for translated HTML fields, set the glide.translated_html.sanitize_all_fields property is true.



Thanks,


Abhishek



Please mark this response as correct and helpful via your post link (how to remove html codes in the Description field   ) to help others with the same question.


Hi Sneha,



I have tried above script in the link in Business rule...its not working.



Can you please guide me what im doing wrong??


Hi Swathi,



Use this script during onchange of the description field,



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


g_form.setValue('description',desc);



Thanks,


Vinitha.K