@Mentions Comments in Notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2023 07:29 AM
Hi Team,
I've created a new notification and mail script to include the recent work notes comments- in the notification when a user is mentioned through @Mention. However, when testing the notification, the subject line and the body of the email isn't being populated with the mail script. I've included the mail script below:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template, /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action, /* Optional GlideRecord */ event) {
var result = new ActivityMentionEmailValues().getEmailValues(current.table, current.document);
var recordGR = new GlideRecord(current.table);
if (result) {
result = JSON.parse(result);
email.setSubject(gs.getMessage("You have been mentioned in {0}", result.subjectText));
template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'>In the following case, you have been mentioned by " + current.user_from.name + ", with comments as: " + "<br>" + "<br/>" + recordGR.comments.getJournalEntry(1));
}
})(current, template, email, email_action, event);
I don't believe it's anything on the notification itself that isn't working so it must be the mail script. Any insight would be appreciated, thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2024 12:33 AM
So it looks like you started the query for the record on the table with your var recordGR = new GlideRecord(current.table); but never actually executed the query and got the record available to prolerly leverage the portion of code where you use recordGR.comments…
normally after the definition of the GlideRecord variable, I would expect to see some addition of query parameters to help you get to the record, and then after you execute the query, a check if there is a record returned ( i.e. if (recridGR.next() ) before you would be able to leverage the recordGR.comments the way you are attempting to do so.