Article approval trigger to Ownership Group, Knowledge Owner and Manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 04:33 PM
Hi,
OOTB with the Ownership Group functionality enabled, the article approval is only triggered to ownership group members and not the Knowledge Manager and Owner, if the Ownership Group field is filled in the article.
Is there a way to trigger the article approvals to all Ownership Group, Knowledge Owner and Manager?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 06:12 PM
Hi,
Out of box, when you enable the Ownership Group functionality, it's by design to go to the Ownership Group specifically as the ownership has been delegated to them. With that said, you could, technically, adjust the out of box workflow to accommodate what you're wanting to do, but I'd recommend at a minimum working with the owner and manager and understand why they may want to still approve/review articles when that goes against the whole point of ownership groups.
Anyways, if you're using the out of box workflow for KB approval such as: Knowledge - Approval Publish. You'll see in the very first workflow activity it assigns the approvers. In that activity, is a call to a script include: KBWorkflow().getApprovers(current); - which is really in the script include KBWorkflowSNC.
This will look for the ownership group system property being set to true or not. If true, it enters that section of code and returns the "users". So, if you wanted to adjust this, you'd have to have to override this function in the script include KBWorkflow and add the getApprovers function to it (so copy and paste the above into it, basically). Then, you'd need to change the return users line to something like this...I've already edited it for you.
getApprovers: function(knowledgeGR) {
if (this.isVersioningInstalled() && gs.getProperty("glide.knowman.ownership_group.enabled",'false') +'' == 'true') {
var users = new KBOwnershipGroup().getOwnershipGroupMembers(knowledgeGR);
if (gs.getProperty("glide.knowman.ownership_group.allow_self_approval", 'true') == 'false') {
var author = (knowledgeGR.revised_by && knowledgeGR.revised_by != '') ? knowledgeGR.getValue("revised_by") : knowledgeGR.getValue("author");
if (users.indexOf(author) != -1)
users.splice(users.indexOf(author), 1);
}
if (users.length > 0) {
users = this._filterInactiveUsers(users.toString());
if (!gs.nil(users))
//Allen added-adjusted this part
if (knowledgeGR.kb_knowledge_base.owner.toString()) {
users = users + knowledgeGR.kb_knowledge_base.owner.toString();
}
if (knowledgeGR.kb_knowledge_base.kb_managers.toString()) {
users = users + knowledgeGR.kb_knowledge_base.kb_managers.toString();
}
users = this._filterInactiveUsers(users.toString());
return users;
// End Allen edit
}
}
var kbOwner = knowledgeGR.kb_knowledge_base.owner;
var kbManagers = knowledgeGR.kb_knowledge_base.kb_managers;
var approvers = '';
if (kbOwner.active) {
//Approval activity will handle any trailing comma, if there are no managers.
approvers = kbOwner + ",";
}
approvers = approvers + this._filterInactiveUsers(kbManagers);
return approvers;
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2023 07:56 PM
Hi Allen,
Thanks for your reply.
My Knowledge base has the OOTB Knowledge - Approval Publish workflow. I have created a copy of the OOTB KBWorkflowSNC Script Include and updated with the script you shared. I have referred the new Script Inlcude within the OOTB KBWorkflow Script Include.
However, upon drafting a article and clicking on Publish button to trigger approval, the article doesn't move to review state for approvals.
Not sure if I am still missing some step here?
Attached snips for reference

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2023 08:14 PM
Hi,
All you needed to do was copy my getApprovers function and add that to the out of box KBWorkflow script include. Any function in that script include overrides the function (if applicable) in the KBWorkflowSNC script include. You didn't need to adjust anything else anywhere to include the out of box workflow. Please re-read my above reply again.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 02:35 AM
In addition to Allens brilliant comment.
When we need to do customizations to functions in KBWorkflowSNC ServiceNow allows us make our own version of the same function by placing it in KBWorkflow hereby minimizing technical debt.
An addition to Allens script is to allow for the native function to be called if custom conditions are not met
var KBWorkflow = Class.create();
KBWorkflow.prototype = Object.extendsObject(KBWorkflowSNC, {
initialize: function () {
},
/**
* This function..
* @Param GlideRecord kb_knowledge that is going through approval
* @return String comma seperated list of user_ids
*/
getApprovers: function (knowledgeGR) {
// This first evaluation also exist in the KBWorkflowSNC version of getApprovers.
if (this.isVersioningInstalled() && gs.getProperty("glide.knowman.ownership_group.enabled", 'false') + '' == 'true') {
// Custom functionality
// Custom logic did not return an approver. Fallback to native functionality instead (other group members will approve).
return KBWorkflowSNC.prototype.getApprovers.call(this, knowledgeGR);
}
},
type: 'KBWorkflow'
});
/Anders