I want to hide few knowledge categories from the list while creating knowledge article
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2025 08:25 AM
We have introduced new field named 'Secure Category' which is of type 'true/false' and if the top category is marked as secured means true then while creating the article when we click on the reference icon to select categories then the one which was marked as secured and its sub-categories should not be visible there for us to select.
I checked the dictionary of this field and found it is calling an OOB script include in reference qualifier section.
I extended the OOB script include in a custom one and added few checks to exclude secured categories and updated in reference qualifier section of dictionary but I believe the script include itself is not getting called.
Below is the code for extended script include:
var ExtendedGlobalKnowledgeUtil = Class.create();
ExtendedGlobalKnowledgeUtil.prototype = Object.extendsObject(GlobalKnowledgeUtilSNC, {
getRefQualCategoryIdsForKB: function(kbKnowledgeBaseId) {
var ids = this.getCategoryIdsForKB(kbKnowledgeBaseId);
var validIds = [];
for (var i = 0; i < ids.length; i++) {
if (!this.isCategorySecured(ids[i])) {
validIds.push(ids[i]);
}
}
return validIds.length > 0 ? 'sys_idIN' + validIds.join(',') : '';
},
isCategorySecured: function(categoryId) {
var categoryGR = new GlideRecord('kb_category');
if (categoryGR.get(categoryId)) {
return categoryGR.u_secure_category == true;
}else{
return false; // Treat as not secured if not found
}
},
type: 'ExtendedGlobalKnowledgeUtil'
});
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2025 10:52 PM
Hello @nikitajos04 ,
Creating a Read ACL that restricts the access for unauthorized users should work just as well.
UI Policies are not applicable in this context.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2025 08:02 PM
Hello @Robert H,
I have written below code in read ACL which is on kb_category table to hide visibility of secured categories. It is working in the list view of category table but when we check in category field on knowledge table, it is not working. Please suggest.
if (gs.hasRole('admin') || gs.hasRole('knowledge_admin')) {
answer = true;
} else {
answer = !current.u_secure_category;
}
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2025 10:37 PM
Hello @nikitajos04 ,
It seems the code for the Knowledge Category Picker popup does not honor ACLs. As mentioned earlier, there is no way to modify it.
Please use the Query Business Rule solution, which you had confirmed is working fine.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2025 11:40 PM
Hello @Robert H,
While testing I found that the before query business rule is impacting the ACLs which are written on knowledge table and not allowing it to be executed. BR is taking high priority and stopping the ACL execution. In both BR and ACL, the current object is being used.
Thanks,