How to send only recent comments added on incident record

Community Alums
Not applicable

Hi Team,

 

We have a system notification created which runs on updated record and when additional comment changes and we want only the latest comments to be sent and not all.

Currently its sending all the comments.

Please find below the Notification created

When to Send:

Ankur20_0-1728490796861.png

 

 

What it will contain:

Ankur20_1-1728490870572.png

 

If you see in the above screenshot I am using ${current.comments} but its sending all the earlier comments as well. How to fix it.

2 ACCEPTED SOLUTIONS

debendudas
Mega Sage

Hi @Community Alums ,

To get the latest comments use an email script and use the below script:

var latest_comments = currrent.comments.getJournalEntry(1); // This method retrieve the latest additional comments
template.print(latest_comments);

If this solution helps you then, mark it as accepted solution ‌‌✔️ and give thumbs up 👍

View solution in original post

SN_Learn
Kilo Patron
Kilo Patron

@Community Alums ,

 

Just to add on, if you want to remove the name, date time from that comments then you can use the below:

current.comments.getJournalEntry(1).match(/\n.*/gm).join('').replace(/^\s*\n/gm, "");

 

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

View solution in original post

2 REPLIES 2

debendudas
Mega Sage

Hi @Community Alums ,

To get the latest comments use an email script and use the below script:

var latest_comments = currrent.comments.getJournalEntry(1); // This method retrieve the latest additional comments
template.print(latest_comments);

If this solution helps you then, mark it as accepted solution ‌‌✔️ and give thumbs up 👍

SN_Learn
Kilo Patron
Kilo Patron

@Community Alums ,

 

Just to add on, if you want to remove the name, date time from that comments then you can use the below:

current.comments.getJournalEntry(1).match(/\n.*/gm).join('').replace(/^\s*\n/gm, "");

 

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.