- 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-12-2023 07:21 AM
Hi @EricG,
The Approval has been changed over the years. You should be using the documentID, instead of the sysapproval reference to Task.
Within the email notification to get the reference information, you can make use of an email template.
The template should look like something like (untested) :
var grSource = new GlideRecord(current.getValue('source_table'));
if(grSource.get(current.getValue('document_id'))){
template.print(gs.getMessage("<h>Approval regarding " + grSource.getValue('number') + " " + grSource.getValue('short_description') + "</h>"));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 01:27 PM
OK, I've tried this and not working. I couldn't get the script to work in Email Templates.
Tried using the idea in Email Scripts and Information showed up. However, this didn't work for Publish, as I'm using a Two approval process (Group Manager and KB Manager approvals).
When i previewed, it looked great. But it didn't show up in the out box. What i got was CatItem Approval.
I've back out my updates and started over.
Are there any more ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 04:23 AM
Hi @EricG,
Sorry for the delay...
On creation of the approval, it shouldn't matter which approval, you can trigger the email.
If an email is not being generated even though the conditions are met, this can have multiple reasons. E.g. the user has deactivated the specific notification or the user has notifications disabled on the user profile (this happened with some of my customers on all non-prod instances to lower the amount of mails being generated).
If you did get an email (the CatItem Approval mail), have a look at the conditions of the notification and priority of your notification and maybe it should be excluded from the CatItem Approval mail, to prevent multiple mails being sent.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 10:37 AM
@Hayo LubbersThank You. The documentation didn't quite explain it has you did.
If I understand correctly, I will need to place the sample code you provided in the Email Template portion of the Email Notification.
And then use the script to build the Notification verbiage.
E.G.
Hi Approver:
This KB # - Short Descript is requiring to Approve the WORKFLOW STATE.
Etc....
To I have that right? I haven't addressed notification in so long. Just wanted to make sure.