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

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

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

4 REPLIES 4

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

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.

asknote50
Tera Contributor

@Ajeet Kumar1  on what table you have created event and notification?