- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2016 11:21 AM
We have moved our Knowledge v3 environment from DEV to TEST. We have created a new Manager approval process workflow. In a nutshell, each article created (we allow all ITIL users to create new knowledge articles) is routed to the author's manager for approval, then onto the Knowledge Admins for approval and subsequent PUBLICATION. My question is, we want the Knowledge Managers or Admins? to be able to bypass this process. We want the Knowledge managers and/or admins to be able to create and publish articles without any approval. How can this be accomplished?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2016 08:24 AM
Jena from ServiceNow had this solution for an IF activity statement and it worked for us. I would have never been able to come up with this on my own.
answer=ifScript();
function ifScript(){
var auth= new GlideRecord('sys_user');
auth.get(current.author.toString());
var roles= new GlideRecord('sys_user_has_role');
roles.addQuery('user',auth.sys_id.toString());
roles.addQuery('role','57b0578037103100007b2863b3990ec0'); // sys_id of knowledge_admin
roles.query();
if (roles.next()) return 'yes';
var mgr= new GlideRecord('sys_user');
var kb = new GlideRecord('kb_knowledge_base');
kb.get(current.kb_knowledge_base.toString());
mgr.addQuery('sys_id','IN',kb.kb_managers);
mgr.query();
while (mgr.next())
{
if (mgr.sys_id==current.author.sys_id) return 'yes';
}
return 'no';
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2016 06:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2016 07:24 PM
Hi Barbara
You can use the IF activity of the workflow at the very beginning to determine if the knowledge article author is "admin" OR "manager" of the knowledge base of knowledge article. If that is the case, your IF activity should run yes , then you can simply create another connector and bypass the approval process.
Basic if script could be like
ifScript();
function ifScript(){
if(current.kb_knowledge_base.kb_managers.toString().indexOf(current.author.toString()) > 0) // it checks if author is manager of knowledge base
// you can also add the similar condition to check if author is admin as well and OR with above if statement
return 'yes';
}
else {
return 'no';
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 07:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2016 08:24 AM
Jena from ServiceNow had this solution for an IF activity statement and it worked for us. I would have never been able to come up with this on my own.
answer=ifScript();
function ifScript(){
var auth= new GlideRecord('sys_user');
auth.get(current.author.toString());
var roles= new GlideRecord('sys_user_has_role');
roles.addQuery('user',auth.sys_id.toString());
roles.addQuery('role','57b0578037103100007b2863b3990ec0'); // sys_id of knowledge_admin
roles.query();
if (roles.next()) return 'yes';
var mgr= new GlideRecord('sys_user');
var kb = new GlideRecord('kb_knowledge_base');
kb.get(current.kb_knowledge_base.toString());
mgr.addQuery('sys_id','IN',kb.kb_managers);
mgr.query();
while (mgr.next())
{
if (mgr.sys_id==current.author.sys_id) return 'yes';
}
return 'no';
}