We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

How to get the last comment added by the agent onto notification

Not applicable

I have a use case where I am told to get the last comment added by an agent when rejecting the change request

I tried to use the below method using an email script but it doesn't fit my exact requirements -

 

(function runMailScript(current, template, email, email_action, event) {
var latestComment = current. comments.getJournalEntry(1);
template.print(latest comment);
})(current, template, email, email_action, event);
 
The output I get is the last comment as well as the additional details such as time and the user's name, which shouldn't be the case.
 

Something like this - 

28/02/2024 19:53:39 GMT - Shwetha Shenoy (Comments) reject and cancel

 

I only require the comments i.e. in the above scenario - reject and cancel and not the extra details i.e - 28/02/2024 19:53:39 GMT - Shwetha Shenoy.

 

6 REPLIES 6

Hi @Community Alums 

 

Below post could be helpful :

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0529930

 

Thanks & Regards

Amit Verma

Thanks and Regards
Amit Verma

Yaraslau
Kilo Sage

Try ${comments:1} or ${comments:2} or ...