Issue with email notification for KB articles

dev_S
Tera Expert

Hi All,

 

I have a issue where I have a notification for KB articles which are going to expire in 10days the email should be triggered to the KB article author and in CC same Knowledge base managers or owners.

But in case the the notification is getting triggered to author but in CC KB managers or owners of different knowledge base.

I have tried but could not fix the issue If someone faced similar kind of issue or aware of the issue please let me know what might be the issue.
Thanks in advance!!

Below is the email script configured for the notification

(function runMailScript(current, template, email, email_action, event) {
    var ccSet = {};

    // Get the Article record from the current kb article
    var articleGR = new GlideRecord('kb_knowledge');

    articleGR.addQuery('sys_id', current.sys_id);
    articleGR.query();
    if (articleGR.next()) {

        // Get the Knowledge Base from the Article record
        var kbGR = new GlideRecord('kb_knowledge_base');
        if (kbGR.get(articleGR.kb_knowledge_base)) {

            // Add KB Owner to CC
            if (kbGR.owner) {
                var ownerGR = new GlideRecord('sys_user');
                if (ownerGR.get(kbGR.owner)) {
                    ccSet[ownerGR.email] = true;
                }
            }

            // Add KB Managers to CC
            var managerIds = kbGR.kb_managers.toString().split(',');
            for (var i = 0; i < managerIds.length; i++) {
                var mgrGR = new GlideRecord('sys_user');
                if (mgrGR.get(managerIds[i].trim())) {
                    ccSet[mgrGR.email] = true;
                }
            }
        }
    }
1 REPLY 1

brianlan25
Kilo Patron

Instead of trying to script it why don't you just set the author and knowledge base owner on the "who will receive" tab in the notification in the user/group fields.

brianlan25_1-1783011578429.png