Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Not able to trigger notification for KM retire approval

Ajeet Kumar1
Mega Contributor

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);

1 ACCEPTED SOLUTION

Not applicable

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

View solution in original post

5 REPLIES 5

amaradiswamy
Mega Sage

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);

Not applicable

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

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.

Hi Ajeet,

I have followed your steps and it is not working.