Knowledge workflow: default approvers are added to the approver list

JahnaviC
Tera Contributor

Hi,

I am working on knowledge flow, I have created the  publish approver flow as per my requirement 1st the knowledge manager approval and then Knowledge admin approval. But when create an article in the knowledge base it is taking the owner and owner manager approval and then the flow I created is being trigged. How can I remove the initials approval that are populating by default even if they are not present in the flow ?

I check if there were any business rules that are trigging but no there are non. 

 

Is there anything that I should modify in the default KBworkflow Script Include ? that a read only field . I belive this is the section in the script that is influencing the approver list.

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))
                    return users;
            }
        }
        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;
    },
 
 
 
I tried using an override script: but it does not help
var KBWorkflow = Class.create();
KBWorkflow.prototype = Object.extendsObject(KBWorkflowSNC, {
   
    initialize: function() {
        // Call parent class initialization if needed
        gs.info("[KBWorkflow] Initialized.");
    },

    getApprovers: function(knowledgeGR) {
        gs.info("[KBWorkflow] getApprovers() called for KB: " + knowledgeGR.kb_knowledge_base);
       
        if (this.isVersioningInstalled() && gs.getProperty("glide.knowman.ownership_group.enabled", 'false') + '' == 'true') {
            var users = new KBOwnershipGroup().getOwnershipGroupMembers(knowledgeGR);
            gs.info("[KBWorkflow] Ownership group members: " + users);

            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) {
                    gs.info("[KBWorkflow] Removing author from approvers: " + author);
                    users.splice(users.indexOf(author), 1);
                }
            }

            if (users.length > 0) {
                users = this._filterInactiveUsers(users.toString());
                gs.info("[KBWorkflow] Active ownership group members: " + users);
                if (!gs.nil(users))
                    return users;
            }
        }

        var kbOwner = knowledgeGR.kb_knowledge_base.owner;
        var kbManagers = knowledgeGR.kb_knowledge_base.kb_managers;
       
        gs.info("[KBWorkflow] Owner: " + kbOwner);
        gs.info("[KBWorkflow] Managers: " + kbManagers);

        var approvers = [];
       
        // Add Owner if active
        if (!gs.nil(kbOwner) && kbOwner.active) {
            gs.info("[KBWorkflow] Adding active owner to approvers: " + kbOwner);
            approvers.push(kbOwner.toString());
        }

        // Add Managers (filtered for inactive users)
        var activeManagers = this._filterInactiveUsers(kbManagers);
        gs.info("[KBWorkflow] Active Managers: " + activeManagers);
       
        if (!gs.nil(activeManagers)) {
            approvers.push(activeManagers);
        }

        var finalApprovers = approvers.join(',');
        gs.info("[KBWorkflow] Final Approvers List: " + finalApprovers);

        // Return single approval request with both Owner & Managers
        return finalApprovers;
    },

    type: 'KBWorkflow'
});
 
 
 
2 REPLIES 2

Kieran Anson
Kilo Patron

To understand correctly, have you created a flow in workflow studio with a trigger type of created/updated?

 

Knowledge management hasn't yet moved over to using workflow studio, so will still call the workflows defined on the knowledge base 

Yeah, I didn't want to use workflow editor as I could not find much information how how to build and use it like the the workflow studios has.