Latest comment not populating via email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 01:00 AM
Hello,
I am currently trying to populate the latest additional comment added (where any user is tagged with @ mention) of a particular table with help of a custom email script.
Notification utilized : Activity Stream Mention Email (Notification is running on live_notification table)
Script used for populating latest comment:
var gr=new GlideRecord ('sys_journal_field');
gr.addEncodedQuery("name=tablename^element=comments^element_id"+current.sys_id);
gr.orderByDesc('sys_created_on');
gr.setLimit(1);
gr.query();
if(gr.next()){
template.print("latest comment is"+gr.value);
}
Note:- Over the email script, rest of the details like number, subject etc. of the records of the table for the particular @ mention gets populated over email notification.
Kindly assist if anyone has any recommendations/solution to it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 01:24 AM
Hi @Arjit Gourav ,
Instead of doing it this way you can query the actual table where the record is present for eg incident is the table then query the incident table & to fetch the latest comment u can try fetching it like below.
gr.comments.getJournalEntry(1);
3.27 getJournalEntry(int)
Gets either the most recent journal entry or all journal entries.
Parameters: -1: get all journal entries, 1: get the most recent journal entry.
Thanks,
Danish