- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 06:36 AM
I have a request from my Users to add recent Worknotes () to the Activity Stream @Mention Email notification. I tried pasting "" to the bottom of the notification. But that doesn't work. From what I've read, it sounds like I might need to include that line somewhere in the mail script that is used in the @mention email but I am not sure how to do that. Any help would be appreciated.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 07:07 AM
Hi,
Yes, you would need to edit the mail script. You can use my script as an example, but this should get you moving pretty good. The mail script to edit would be: ng_activity_mention_body
With script for example:
var result = new ActivityMentionEmailValues().getEmailValues(current.table, current.document);
if (result) {
result = JSON.parse(result);
email.setSubject("You have been mentioned in " + result.subjectText);
var gr = new GlideRecord(current.table);
gr.get(result.recordSysId);
template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'>You have been mentioned by " + current.user_from.name + " in <a href='/" + result.className + ".do?sys_id=" + result.recordSysId + "'>" + result.linkText + "</a></p>");
template.print("And this is the latest work note:<p> " + gr.work_notes.getJournalEntry(1) + " </p>");
}
Which takes the last work note from the record in mention, for example:
And gives you an email like so:
Which is used in the notification: Activity Stream @Mention Email
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 07:07 AM
Hi,
Yes, you would need to edit the mail script. You can use my script as an example, but this should get you moving pretty good. The mail script to edit would be: ng_activity_mention_body
With script for example:
var result = new ActivityMentionEmailValues().getEmailValues(current.table, current.document);
if (result) {
result = JSON.parse(result);
email.setSubject("You have been mentioned in " + result.subjectText);
var gr = new GlideRecord(current.table);
gr.get(result.recordSysId);
template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'>You have been mentioned by " + current.user_from.name + " in <a href='/" + result.className + ".do?sys_id=" + result.recordSysId + "'>" + result.linkText + "</a></p>");
template.print("And this is the latest work note:<p> " + gr.work_notes.getJournalEntry(1) + " </p>");
}
Which takes the last work note from the record in mention, for example:
And gives you an email like so:
Which is used in the notification: Activity Stream @Mention Email
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 11:00 AM
Allen, thank you so much. This gets me very close to what I want. I modified the little comment and increased the number of worknotes up to the 3 last entries. But they are clustering all together in one blob. Is there anything I can do to insert a line break between worknotes if I want to include more than just the last one?
template.print("Recent Work Note Comments:<p> " + gr.work_notes.getJournalEntry(3) + " </p>");
What it looks like in the email:
Recent Work Note Comments:
05-13-2021 01:55:PM EDT - Brent Hagmayer (Work notes) @Dustin FioravantiDustin, what do you think? Is this good enough to show Recent Worknotes in the @Mention notification? 05-13-2021 09:11:AM EDT - Brent Hagmayer (Work notes) @Dustin FioravantiCan you take a look and offer suggestions?
I would prefer this format:
Recent Work Note Comments:
05-13-2021 01:55:PM EDT - Brent Hagmayer (Work notes) @Dustin FioravantiDustin, what do you think? Is this good enough to show Recent Worknotes in the @Mention notification?
05-13-2021 09:11:AM EDT - Brent Hagmayer (Work notes) @Dustin FioravantiCan you take a look and offer suggestions?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 12:46 PM
Hi,
Please see this documentation on how to get 'x' amount of work notes and then iterate through them individually. This would allow you to template.print each one and add some HTML such as <p> to space them out a bit more:
Please mark reply as Helpful, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!