- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 09:29 PM
We have an issue with some user provisioning for the user's manager. Until we find a fix we want to avoid issues with items auto approving so want to prevent any user who manager field is either empty of the manager in their is inactive to not be able to raise a request.
Ideally one step to do this would be good but we could say to do a scheduled task each day to remove inactive managers from any user's and then have another step for stopping anyone with an empty manager from raising a request.
Any help would be greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 02:39 AM
there is small correction in my script, I updated it above
sharing here as well
gr.addQuery("sys_id", user_id); // it should be sys_id and not sys+id
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
05-14-2025 11:52 PM
Hello @wiganmichae ,
Please note that if you ever add other "Available for" criteria to your items/categories then this solution might no longer work and users with inactive managers may get access to them again.
A robust solution would be to reverse the logic and use "Not available for", as outlined here.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 10:44 PM
Hello @wiganmichae ,
Please create a new User Criteria for Users with inactive or missing managers, with the following script:
var grUser = new GlideRecord('sys_user');
grUser.addQuery('sys_id', user_id);
grUser.addQuery('manager.active', 'true');
grUser.query();
answer = !grUser.hasNext();
Then add this User Criteria to the Not Available For list of all Catalog Items where this rule shall apply.
It's important that we use "Not Available For" because it overrides any criteria in the "Available For" list that might still let users without active managers access the Catalog Item.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2025 10:28 PM
Hello @wiganmichae ,
Did you get a chance to try this solution, which has been tested prior to posting it?
Regards,
Robert