display last additional comment in notification
This content was last updated in 2024. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2024 11:48 PM
hwy'
needs help to write email script to retrieve the last additional comment in the specific request item .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 12:01 AM
Check this, it has the script just put it on email.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 01:26 AM
Hi @ofekg
Have you tried this method below?
getJournalEntry(Number mostRecent)
Returns either the most recent journal entry or all journal entries.
| mostRecent | Number | If 1, returns the most recent entry. If -1, returns all journal entries. |
| String | For the most recent entry, returns a string that contains the field label, timestamp, and user display name of the journal entry. For all journal entries, returns the same information for all journal entries ever entered as a single string with each entry delimited by "\n\n". |
Example
//get the most recent entry
var comment = current.comments.getJournalEntry(1);
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 01:40 AM
Hi @ofekg ,
Follow below steps to get comments printed in your notification.
- Create notification and call mail script. Syntax is: ${mail_script:comments} where comments is mail script name.
- Use below script in email script to get it printed in your email body.
template.print('<b>Comments:</b> ' + current.comments.getJournalEntry(1) + '<br><br>');
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------