My Direct Reports on user profile, need a user criteria of the same

Achyuth Krishna
Tera Contributor

Hi All,

 

Requirement is to create a user criteria to add to Knowledge articles. The condition is : Users who have Direct reports under their profile (From Employee Center Portal)should be able to view those Knowledge articles. Need inputs to create that User Criteria.

 

Thanks

1 ACCEPTED SOLUTION

Vaibhav127
Tera Guru

Hi Achyuth Krishna,

 

Im guessing direct reports are the user who have the logged i user as the manager.

You can write script in user criteria and check if logged in user is manager of any user then return true.

 

var grUser = new GlideRecord('sys_user');

grUser.addQuery('manager',gs.getUserID());

grUser.query();

if(grUser.hasNext())

answer = true;

 

Add this user criteria to the article record.

View solution in original post

2 REPLIES 2

Vaibhav127
Tera Guru

Hi Achyuth Krishna,

 

Im guessing direct reports are the user who have the logged i user as the manager.

You can write script in user criteria and check if logged in user is manager of any user then return true.

 

var grUser = new GlideRecord('sys_user');

grUser.addQuery('manager',gs.getUserID());

grUser.query();

if(grUser.hasNext())

answer = true;

 

Add this user criteria to the article record.

This is super helpful for my question (here https://www.servicenow.com/community/employee-center-forum/employee-center-menu-item-show-only-to-pe...) as well!

 

I am wondering, though, if I do this in a Menu Item, will that slow down performance for my Employee Center if it has to do this script every time anyone loads the page?