Close note is HTML field, how to hide HTML tags from activity log

asd22
Tera Contributor

Hello. i needed to change the close note to HTML the same as our additional comment.

 But with close note the HTML tags show up, it does not do this with our additional comments.

Any fix? 

asd22_0-1743595960744.png

 

14 REPLIES 14

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @asd22 

 

https://www.servicenow.com/community/developer-forum/remove-html-tags-in-list-view-of-an-html-field/...

 

https://www.servicenow.com/community/developer-forum/remove-html-tags-from-activities-on-a-form/m-p/...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

i tried to change the BR script that posts the comments

(function executeRule(current, previous /*null when async*/) {

    current.comments = "Saken lukkes: " + gs.stripHTML(current.close_notes);
    //current.u_additional_comments = "<p>Saken lukkes:</p><p>" + gs.stripHTML(current.close_notes) + "</p><p> </p>";

})(current, previous);

 but this did not work, will try what you linked 

Ankur Bawiskar
Tera Patron
Tera Patron

@asd22 

try this and use this function

GlideSPScriptable().stripHTML
(function executeRule(current, previous /*null when async*/) {

    current.comments = "Saken lukkes: " + GlideSPScriptable().stripHTML(current.close_notes);
    //current.u_additional_comments = "<p>Saken lukkes:</p><p>" + gs.stripHTML(current.close_notes) + "</p><p> </p>";

})(current, previous);

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

Hello again, thanks for the script. It removed the tags, but i see now this is not what i want. 
Above is additinal commets(HTML field) and it keeps the text formant when posted.

Under you have close notes wich now is posted fine but it does not keep the format

asd22_0-1743597377044.png