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.

Remove HTML tags from notification

Darlene York
Tera Contributor

 

Hello,

 

I wrote a notification on the kb_feedback table. I want to get the comment from the, but its keeping the HTML tag.  Any assistance would be greatly appreciated.

DarleneYork_0-1690401991229.png

 

 

 

DarleneYork_0-1690401595075.png

 

1 ACCEPTED SOLUTION

sushantmalsure
Mega Sage

This is happening because comments are stored with html tags around it.

Instead of using ${comments} directly do following (example):

 

can create new email script (System Notification>email>Notification Email Script) to print comments and then use that script in your notification.

Example:

sushantmalsure_0-1690465106192.png

sushantmalsure_1-1690465118275.png

 

sushantmalsure_2-1690465133463.png

 

 

Mail script: 

Name: writeComments

script: 

var com = current.getValue("comments");
template.print(com);

 

Call script in notification: 

${mail_script:writeComments}

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

View solution in original post

12 REPLIES 12

Good Morning,

Thank you for your reply.  When I remove the tags and hit save, and open it back it re-applies the tags.

DarleneYork_0-1690464605613.png

 

instead of ${comments}

call a mail script, (for example: ${mail_script:printComments}) and print the comments in mail script

piyushsain_0-1690466913317.png

 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

sushantmalsure
Mega Sage

This is happening because comments are stored with html tags around it.

Instead of using ${comments} directly do following (example):

 

can create new email script (System Notification>email>Notification Email Script) to print comments and then use that script in your notification.

Example:

sushantmalsure_0-1690465106192.png

sushantmalsure_1-1690465118275.png

 

sushantmalsure_2-1690465133463.png

 

 

Mail script: 

Name: writeComments

script: 

var com = current.getValue("comments");
template.print(com);

 

Call script in notification: 

${mail_script:writeComments}

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

I will try this.  Thank you so much.

Sure keep us posted and mark answer correct once you are satisfied😊

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure