Notification emails are not included Worknotes for users - Activity Stream @Mention Email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 03:09 AM - edited 11-23-2023 03:17 AM
Hello Team,
when email triggered with activity Stream @mention Email which doesn't include work notes. How should I add work notes in the below mailsscript.
existing mails script is :
But I need to include worknotes, please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 04:51 AM
Hi @B Ashok
Add below line in the email script
template.print(current.work_notes.getJournalEntry(-1));
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 07:11 AM
Hi,
Please use below code
(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);
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'>");
template.print(gs.getMessage("You have been mentioned by {0} in", current.user_from.name));
template.print(current.work_notes.getJournalEntry(-1));
template.print(" <a href='/nav_to.do?uri=" + result.className + ".do?sys_id=" + result.recordSysId + "'>" + result.linkText + "</a></p>");
}
})(current, template, email, email_action, event);
Regards,
Piyush Sain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 07:08 AM
It worked but im are getting previous worknotes aswell.
then i tried replacing -1 with 1 it worked but getting last mentioned worknotes for additional comments aswell.
Eg: if i mention somone and add xyz in additional comments im getting email notification which is latest mentioned in worknotes .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 09:08 AM
template.print(current.document.work_notes.getJournalEntry(-1));
This worked for me.
Thanks.