- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 11:37 PM
Hi Team,
When I click on Publish UI Action then state goes to Reveiw and it sends a notification to approver to approve it.
there is a out of box notification (KM: Approve article for publishing) for this but i don see any notification sent when i click on "Retire" UI Action and state is "pending retirement" So i created a business rule triggering event firing notification , but BR is not getting triggered.
Could you check what is wrong below? OR kindly suggest how can i trigger the notification when km is moved to "pending retirement. (It works by BR then it would be good)
BR: after insert/update on sysapproval_approver table
Condition: current.source_table=='kb_knowledge' && current.document_id.workflow_state=='pending_retirement'
Script:
(function executeRule(current, previous /*null when async*/) {
if(current.state.changesTo('requested')){
gs.log("<<I am in>>");
var gr = new GlideRecord('kb_knowledge');
gr.addQuery('sys_id',current.documment_id);
gr.addActiveQuery();
gr.query();
if(gr.next()){
gs.log("<<i am in the loop>>");
gs.eventQueue('knowledge.retirement.approval',gr,gs.getUserID(),gs.getUserName());
}
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 12:20 AM
Hi Amaradi swamy,
Thank you for you help, yes the typo in line 5 was causing the issue.
And as i have created BR, EVENT and Notification on sysapproval_approver table, so
changed the list line as:
gs.eventQueue('knowledge.retirement.approval',current,current.approver);
in notification I selected Param1 as notification reveiver.
Now it is working.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 05:06 AM
There is a typo in line 5, use document_id instead of documment_id. Also, check system logs --> events and see if event has been triggered
(function executeRule(current, previous /*null when async*/) {
if(current.state.changesTo('requested')){
gs.log("<<I am in>>");
var gr = new GlideRecord('kb_knowledge');
gr.addQuery('sys_id',current.document_id);
gr.addActiveQuery();
gr.query();
if(gr.next()){
gs.log("<<i am in the loop>>");
gs.eventQueue('knowledge.retirement.approval',gr,gs.getUserID(),gs.getUserName());
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 12:20 AM
Hi Amaradi swamy,
Thank you for you help, yes the typo in line 5 was causing the issue.
And as i have created BR, EVENT and Notification on sysapproval_approver table, so
changed the list line as:
gs.eventQueue('knowledge.retirement.approval',current,current.approver);
in notification I selected Param1 as notification reveiver.
Now it is working.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 01:00 AM
I am glad that it is working now. Please consider making an answer as correct so that it will be helpful for others having similar question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2025 03:29 AM
@Ajeet Kumar1 on what table you have created event and notification?