How can i use current.comments.getJournalEntry(-1) but get formatted output like when using the normal variable?

Tony V
Tera Guru

 We want to add a full activity list at the bottom of an email notification. I created an email script that simply has

template.print(current.comments.getJournalEntry(-1));

 to get all of them. However it outputs it as a block of text without any line breaks, dividing lines, or bold like you would see when using ${comments}.

Is it possible to get the full activity history and retain the same look as when using the standard variable?

FYI: I don't want to change the glide.system.journal.lines property because there are other notifications using the standard variable where we want to retain the default behavior.

thanks

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

Can you check the 'Newlines to HTML' checkbox in Email script and try

 

find_real_file.png


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

3 REPLIES 3

SanjivMeher
Kilo Patron
Kilo Patron

Can you check the 'Newlines to HTML' checkbox in Email script and try

 

find_real_file.png


Please mark this response as correct or helpful if it assisted you with your question.

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Tony, please see this Docs article:

https://docs.servicenow.com/bundle/helsinki-platform-administration/page/administer/field-administra...

This code will get an array of all the comments that you can then loop through via script and format to your liking.

 

Please mark this post or any as helpful or the correct answer to your question if applicable so others viewing may benefit.

Tony V
Tera Guru
Michael Ritchie, your solution also works but I like the simplicity of Sanjiv Meher's suggestion. I should have seen that option before.
 
Thanks to both of you.