Notification - Most recent comment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 11:57 AM
I'm creating a notification. The notification will be sent to the Assigned To person whenever the customer makes an update to the case via Portal. I would like to include in the email, the most recent comment made by the customer that triggers the notification. I can add additional comments (comments) in the email, but it includes ALL additional comments on the case. Is it possible to include just the most recent comment\update made by the customer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 12:03 PM
Hello
Use notification email script
To get the latest comment type current.comments.getJournalEntry(1);
Then call the email script in the notification
Please mark answer correct/helpful based on impact

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 12:56 PM
Is this for all notifications sent across from ServiceNow for comments? If so, look for
System Properties >> Mail Properties
Change the number to 1. It would mean platform wide any notification sent for comments.
If you want it to be specific for a table you need mail script & use current.comments.getJournalEntry(1); & then use the mail script in notifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 01:43 PM
No. This is just a notification on the Case table for specific conditions. It will be sent to the Assigned To on the case.
In the body of the email/notification, I want to include the most recent update (additional comments) that was just made to the case by the customer.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 02:21 PM
Follow below
1. Create a mail script by navigating to System Notification >> Email >> Notification mail script
2. Name it getlatestcommentsonly with script as below.
(function runMailScript(current, template, email, email_action, event) {
var latestcommentsare = current.comments.getJournalEntry(1);
template.print(latestcommentsare);
})(current, template, email, email_action, event);
3. Go to notification & add below just after the line Short description: ${short_description}
Comments: ${mail_script:getlatestcommentsonly}