knowledge expiry notifications are triggered to wrong users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi All,
I have issue with email script for KB article expiry notification where emails are getting triggered to KB article author and CC (copied)the KB managers and KB owner but they are of different knowledge base. I need to have email triggered to KB author and CC KB managers and KB owner of same knowledge base.
I tried to figure out the issue but not able to find the exact root cause.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @dev_S ,
Can you try with this.
(function runMailScript(current, template, email, email_action, event) {
var kbSysId = current.kb_knowledge_base.sys_id;
var kbGR = new GlideRecord('kb_knowledge_base');
if (kbGR.get(kbSysId)) {
var owner = kbGR.owner; // sys_id of the Owner
var managers = kbGR.kb_managers; // Comma-separated sys_ids of managers
if (owner) {
email.addAddress("cc", owner.email.toString(), owner.name.toString());
}
if (managers) {
var mgrArray = managers.split(',');
for (var i = 0; i < mgrArray.length; i++) {
var userGR = new GlideRecord('sys_user');
if (userGR.get(mgrArray[i])) {
email.addAddress("cc", userGR.email.toString(), userGR.name.toString());
}
}
}
}
})(current, template, email, email_action, event);
