- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 01:11 AM
Morning community,
Probably a common ask but I can't find a previous post that fits the bill. We have a catalogue item that we want to restrict to just managers i.e. those who appear in the manager field of any user in the sys_user table.
Any help appreciated as always.
Thanks, Brad
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 03:45 AM
use script inside user criteria
this will work fine
var userRec = new GlideRecord('sys_user');
userRec.addQuery('manager', user_id);
userRec.setLimit(1);
userRec.query();
answer = userRec.hasNext();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 02:00 AM
I would suggest you to create a group containing managers in your company. Then you can restrict the catalog Item visible for this group only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 02:10 AM
Hi Alp,
Thanks for your response. This is obviously a solution but would would be an admin overhead for the platform team, the idea would be to use a script and leverage the information we already have in the sys_user table rather than running a report and manually adding them every week.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 02:33 AM
You can use the below script on user criteria
checkCondition();
function checkCondition(){
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
if (user.manager !="")
{
return true;
}
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 03:14 AM
Thanks Alp,
When testing this script the behaviour is only restricting access to the catalogue item for a logged in user where their manager field is empty rather than the logged in user not appearing in the manager field of another sys_user.
Thanks
Brad