knowledge
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
(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 code author is receiving the notification but last updated user is not receiving the notification as author and updated by are different
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Have you checked the logs on what you are actually getting? How is the notification configured? Does it only have the event param as recipient, or is the author also set as recipient and works it because of that.
You are using string fields and set them 'to string'. Any reason why? Both updated and created are string fields. So here it's also important what the content of that string field is. Does it contain an email address (also for the updater)?
Add logs to your script if you need to know what exactly is returned.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark