The CreatorCon Call for Content is officially open! Get started here.

Knowledge

Bhavani1995
Tera Contributor

(function executeRule(current, previous /*null when async*/) {

    var kb = new GlideRecord('kb_knowledge');

    if (kb.get(current.document_id)) {

        if (current.state == 'rejected' && previous.state != 'rejected') {

            var author = current.sys_created_by.toString();

            var updater = current.sys_updated_by.toString();

 

            // If author and updater are the same user, send one notification

            if (author == updater) {

                gs.eventQueue('knowledge.approval.rejected', kb, kb.sys_id, author);

            } else {

                // Send notification to last updater

                gs.eventQueue('knowledge.approval.rejected', kb, kb.sys_id, updater);

                // Send notification to author

                gs.eventQueue('knowledge.approval.rejected', kb, kb.sys_id, author);

            }

        }

    }

})(current, previous);

for this author is only receiving the notification, but author and last updated by also should receive the reject notification

1 REPLY 1

GlideFather
Tera Patron

Hi @Bhavani1995,

 

as I see "current" and "previous" it makes it look like a business rule, is that so?

 

Please describe what are you trying to achieve... 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */