Instant Publish of knowledge article if submitter is a member of ownership group or kb manager

Southsayer
Tera Expert

Hi everyone, 

 

we have created 5 knowledge base and I have added retired workflow and also publish workflow (both are approval workflows). only these 5 knowledge bases will be moved to prod. 

 

but, I have an additional requirement that is,

 

1. when we click checkout on published article and make changes and try to publish it should check if the submitter= 'Ownership Group' or KB Manager. If som it should instantly publish the article (we have instant publish workflow ootb).

 

2. if the submitter !=  'Ownership Group' or kb manager, then it should follow approval workflow. 

 

how can I achieve this? 

 

thanks in advance, 

ak

 

4 REPLIES 4

Robbie
Kilo Patron
Kilo Patron

Hi @Southsayer,

 

Essentially you have 2 options here which is to either update the existing "Knowledge - Approval Publish" workflow, or the recommended approach, copy this and adjust it accordingly where before the Approval step a check would need to take place to check if the User is a member of the Owning Group or the KB Manager.

 

The script inside the 'If' block of the Workflow step would follow something similar to the below, however I would recommend testing etc:

 

answer = isMemberOfGroupOrKbMgr();

function isMemberOfGroupOrKbMgr() {
    var loggedInUser = gs.getUser();
    var articleOwningGroup = current.ownership_group.name;
    var kbMgrs = current.kb_knowledge_base.kb_managers;

    if (loggedInUser.isMemberOf(articleOwningGroup) || kbMgrs.indexOf(gs.getUserID()) > -1) {
        return 'yes';
    }
	else{
    	return 'no';
	}
}

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

Hi Robbie, 

Thanks for the reply, I have a question for you.

If it is new knowledge article then it should follow the approval process even  if the submitter is member or ownership group or kb manager. 

 

but if it not new article meaning, checkout is done, updates are made and then publish button is clicked. So only them if the if the submitter is member or ownership group or kb manager, then it should skip approvals and get instantly published. 

 

How can I achieve this? 

thanks 🙂

Hi @Southsayer,

 

No worries. So in order to check if the Article is new or not and help you make this decision, you can leverage the 'Article Versions' visible via the 'Articles Versions' Related List and Tab at the bottom of the form. (Table name: kb_version).

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

Hi Robbie, 

Thank you, would you mind providing me a script for this and can this be added in the workflow if condition as well? 

 

thanks 

snowman