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.

Way to remove Additional Comments text when using $current.comments variable

Community Alums
Not applicable

Hello!  Has anyone found a way to remove the "Additional Comments" text highlighted in the screenshot?  I am using the ${current.comments} variable on my notification and the customer would like it removed but I haven't seen a way to remove it?

1 ACCEPTED SOLUTION

Hi Pete,


Does the below work (untested) ? :

 

notes = notes.replace('(Additional Comments)','');
***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

View solution in original post

6 REPLIES 6

Paul Curwen
Giga Sage

Hi Pete,

This will do the job.

Create a email script as below and put it into your notification removing the existing ${current.comments} line:

(function runMailScript(current, template, email, email_action, event) {


var notes = current.comments.getJournalEntry(1);


notes = notes.replace('Additional Comments','');



template.print('<pre>'+notes+'</pre>');


})(current, template, email, email_action, event);

Regards

Paul

 

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

Community Alums
Not applicable

Hi Paul,

This is great, thank you!  I had to modify the script Comment to comment then it removed the Additional comments text however It still shows the parenthesis (see highlight in screenshot); Any idea on how to remove those parenthesis?  I am in the progress of testing right now

Community Alums
Not applicable

Hi Paul,

I continued to test and I can't seem to get rid of the parenthesis; any thoughts on how to remove the characters? Any help is much appreciated.  Thanks!

Hi Pete,


Does the below work (untested) ? :

 

notes = notes.replace('(Additional Comments)','');
***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul