Specific knowledge base which should be visible only to end users(users with no roles) in portal

Bruce lee
Tera Contributor

Hi,

I have created some knowledge bases that needs to visible only to users with no roles

I have defined user criteria But its not working specifically I have impersonated Itil and adminScreenshot 2025-06-11 022024.png 

In Cannot read user criteria i have gave this code

(function() {
  var roleGr = new GlideRecord('sys_user_has_role');
  roleGr.addQuery('user', user_id);
  roleGr.setLimit(1);
  roleGr.query();
  return roleGr.hasNext(); // true if user has any roles
})();

 

2 REPLIES 2

SANDEEP DUTTA
Tera Patron
Tera Patron

Hi @Bruce lee ,

Can you explain why someone with no roles should see these Knowledge base and with roles , they won't? as in real world, if you someone who has no roles can see the knowledge base if you make it public. However, this would be visible for anyone in the platform.

 

Thanks,
Sandeep Dutta

Please mark the answer correct & Helpful, if i could help you.

That's the client requirement for end users alone specfic Knowledge base needs to be viisble so ur telling technically its not posible right