How can I fetch the latest comment of incident and display it in an email templates of sow.

hasthipooji
Tera Contributor

hasthipooji_0-1776253018107.png

hasthipooji_1-1776253330205.png

 

How can I fetch the latest comment (Additional comments) from an incident and display it in an email template in Service Operations Workspace? I want the RITM number of most recent comment  from the Activities section of the incident to be included in the email template. How can this be achieved?

3 REPLIES 3

TharaS657398130
Mega Guru

Hey

To fetch the latest “Additional comments” from an Incident and show it in an email template, you need to use a mail script because these comments are stored in the sys_journal_field and not directly on the Incident record. In the script, query this table with element_id = current.sys_id and element = comments, sort by created date in descending order, and fetch the latest entry, then print its value in the template; if you also need the related RITM number, you can fetch it from the associated record and include it along with the comment in the email output.

Ankur Bawiskar
Tera Patron

@hasthipooji 

you can't get it directly

you need email script for this

what did you start and where are you stuck?

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

Is an Email Script supported in an Email Template / Email Client Template in Service Operations Workspace (SOW)? I need to fetch the RITM number mentioned in the latest Additional Comment (as shown in the earlier screenshot) and display it in the email template. If this is supported, could you please share the recommended approach or a demo example?