email script notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var number = current.number;
var rejectNotes = "";
var short_desc = current.short_description;
var article_link = gs.getProperty('glide.servlet.uri') + "nav_to.do?uri=kb_knowledge.do?sys_id=" + current.sys_id;
var author;
var revisor = current.revised_by;
if (revisor)
author = revisor.first_name;
else
author = current.author.first_name;
var lastComment, lastCommentLines;
var approval = new GlideRecord("sysapproval_approver");
approval.addQuery("document_id", current.sys_id);
approval.addQuery("state", "rejected");
approval.query();
if (approval.next()) {
lastComment = approval.comments.getJournalEntry(1);
lastCommentLines = lastComment.split("\n");
lastCommentLines.shift();
rejectNotes = lastCommentLines.join('<br/>');
}
var emailContent = {};
emailContent.templateContent =
"Hi " + author + ",<br/>" +
"<br/>" +
"<a href=" + article_link + ">" + number + "</a> is rejected.<br/>" +
"<br/>" +
"<b>Article Title</b>: " + short_desc + "<br/>" +
"<br/>" +
"<b>Rejection comments</b>: " + rejectNotes + "<br/>" +
"<br/>" +
"Please visit the article link if you want to revise the article.<br/>" +
"<br/>";
email.setSubject(number + " is rejected.");
template.print(emailContent.templateContent);
})(current, template, email, email_action, event);
how to do changes in the email script so that sys_updated_by also receive the notification
in the approval publish workflow in the create event param 1 is passed it is triggering to the author how to pass param 2 so that it should trigger to the sys_updated_by in the create event
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Bhavani1995
1) how to do changes in the email script so that sys_updated_by also receive the notification
As per docs. you can use below below methods.
EmailOutbound object Available methods:
|
2)
in the approval publish workflow in the create event param 1 is passed it is triggering to the author how to pass param 2 so that it should trigger to the sys_updated_by in the create event.
-you can pass param1 with comma separated user sys_ids (like author, updated )
Event parm 1 contains recipient | Select this check box if the event parameter 1 contains one or more email recipients (in a comma separated list). This field is visible only when theSend when field is set to Event is fired. |
Event parm 2 contains recipient | Select this check box if the event parameter 2 contains one or more email recipients (in a comma separated list). This field is visible only when theSend when field is set to Event is fired. |
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks!
Krishnamohan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi Krishna mohan
For sys_updated_by if we pass in the event param 1 will it trigger to the last updated user without doing any changes in the mail script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
in the workflow itself where you are sending email ensure you pick the sys_updated_by, query sys_user and then include that as well in recipient list.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi Ankur, can you share the changes of the script because I tried it is not working