Access to the Unpublished Knowledge Article only to the KB owner or to users having knowledge_admin role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2020 12:17 PM
Hi Community,
Please help with the query.
I want to restrict the unpublished knowledge articles to the knowledge owner or to users having knowledge_admin role. However, i am not able to achieve this with the following script. I modified the script a bit for both ACL's and QueryBR but with no access.
Before Query BR on kb_knowledge table with condition as Workflow is not Published.
var kbsysid = current.sys_id;
var kbknowledgebase = current.getDisplayValue(kbsysid);
var knowledgebase = new GlideRecord('kb_knowledge_base');
knowledgebase.addQuery('title',kbknowledgebase);
knowledgebase.query();
if(knowledgebase.next()){
var kbowner = knowledgebase.owner;
if((gs.getUser().getID() == kbowner) )
return true; // answer = current.canRead() for ACL
else
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2020 03:18 PM
Hi Sharjeel,
Thanks for your reply.
This is working fine for unpublished articles which is as per the requirement.However , no one is able to view published articles now. No records are found for published articles for owners or admins.
Thanks,
Abhinandan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2020 03:27 PM
Please be kind to mark the appropriate response as CORRECT so that others can referenced that and get benefited by that.
Happy Coding!
Thanks & Regards,
Sharjeel
Muhammad