Show only last comment in notification email

Cat
Giga Guru

Hi All,

 

I'm creating a flow to handle incidents on hold awaiting caller (automatically sending follow up emails and then closing if no response), but do you know how I can make it add only the last customer visible comment rather than all customer visible comments when creating the email notification?

Cat_0-1771325711933.png

 

 

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron

Hi @Cat 

https://www.servicenow.com/community/developer-forum/inserting-just-the-last-additional-comment-into...

https://www.servicenow.com/community/service-operations-workspace/get-latest-comments-in-email-notif...

 

Often, we need to include the latest comments in email notifications.

To display the most recent comment in an email template or notification body, use:

${comments:1}

If you want to show the latest two comments, use:

${comments:2}
cc: @Ankur Bawiskar 
*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

Ankur Bawiskar
Tera Patron

@Cat 

if you are using notification and email script then link shared by Atul has blog from me

that should help

Get latest comments in email notification 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron

@Cat 

you can't grab it directly

You can query sys_journal_field for your table and field and sort it with Desc and pick latest record

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Dr Atul G- LNG
Tera Patron

Hi @Cat 

https://www.servicenow.com/community/developer-forum/inserting-just-the-last-additional-comment-into...

https://www.servicenow.com/community/service-operations-workspace/get-latest-comments-in-email-notif...

 

Often, we need to include the latest comments in email notifications.

To display the most recent comment in an email template or notification body, use:

${comments:1}

If you want to show the latest two comments, use:

${comments:2}
cc: @Ankur Bawiskar 
*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

have a look on solution provided by Ankur. cced him in my last reply.,

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

@Dr Atul G- LNG 

not sure if that works in flow's "Send Email" flow action

@Cat did you try in flow?

If not then you will have to query sys_journal_field table as per approach I shared earlier.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader