- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 05:47 AM
I'm attempting to get proper notifications out on Knowledge Articles for Approve Publish and approve Retire.
Due to how the sysapproval_approver table is constructed, I see that KB Articles are not a "Reference" like task tickets. So getting additional information about the KB is not possible.
I do see how the OOB approval notification works using the Script include KBKnowledgeSNC. Where it sets the objects returned for the Email notification. The items are extremely limited and I'm unsure whether or not to ask to have the "Read Only" protection removed to get additional fields available, like the workflow_state value and such.
I've also observed that the OOB approval notification doesn't always fire consistently.
I have a Scheduled Job that will resend outstanding approval request (which will fire the notice) or using the OOB resend UI Action will also trigger the approval.
Would appreciate any insights on how others are getting approval notices out (So user know what they are clicking on) and how to make sure they go out consistently.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 05:58 AM
Thank you all for your suggestions. This has been an interesting exercise.
Ended up finding a post that suggested creating a BR to handle this. So i followed it and resolved both the "Notifications not firing on First Approval" and getting 1 notification for Publish and Retire approvals.
Here is what i did.
After Insert Business rule.
Name: KB Article approval - Publish or Retire
Conditions
Script
(function executeRule(current, previous /*null when async*/) {
if(current.state='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('The workflow state is '+gr.workflow_state);
if (gr.workflow_state=="pending_retirement"){
gs.log("<<i am in the loop>>");
gs.eventQueue('knowledge.retirement.approval',current,current.approver);
}
else if (gr.workflow_state=="review" || gr.workflow_state=="draft" ){
gs.log("<<i am in the 2nd loop>>");
gs.eventQueue('knowledge.publish.approval',current,current.approver);
}
}
}
})(current, previous);
Notification
Created two, due to event name, but used the same data fields.
Send to who: approver
What it will contain:
${approver.name}:
Knowledge Article ${document_id} has been request to be published.
Click on the link, ${URI}, to Approve/Reject it.
Use the I icon (graphic) next to the Approving record to review the article.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 05:58 AM
Thank you all for your suggestions. This has been an interesting exercise.
Ended up finding a post that suggested creating a BR to handle this. So i followed it and resolved both the "Notifications not firing on First Approval" and getting 1 notification for Publish and Retire approvals.
Here is what i did.
After Insert Business rule.
Name: KB Article approval - Publish or Retire
Conditions
Script
(function executeRule(current, previous /*null when async*/) {
if(current.state='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('The workflow state is '+gr.workflow_state);
if (gr.workflow_state=="pending_retirement"){
gs.log("<<i am in the loop>>");
gs.eventQueue('knowledge.retirement.approval',current,current.approver);
}
else if (gr.workflow_state=="review" || gr.workflow_state=="draft" ){
gs.log("<<i am in the 2nd loop>>");
gs.eventQueue('knowledge.publish.approval',current,current.approver);
}
}
}
})(current, previous);
Notification
Created two, due to event name, but used the same data fields.
Send to who: approver
What it will contain:
${approver.name}:
Knowledge Article ${document_id} has been request to be published.
Click on the link, ${URI}, to Approve/Reject it.
Use the I icon (graphic) next to the Approving record to review the article.