- 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-08-2025 09:46 PM - edited 05-12-2025 02:40 AM
you can hide the catalog item itself for those users so that they don't see in portal and don't submit, rather than showing them and then stopping the submission
You can use User Criteria for this and use advanced script
Then add that User Criteria in "Available For" related list on that catalog item
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", user_id);
gr.query();
if (gr.next()) {
if (gr.manager.toString() == '' || gr.manager.active.toString() == 'false')
answer = false;
else
answer = true;
}
1) click New in the related list of Available for
2) something like this
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-10-2025 11:23 PM
Hope you are doing good.
Did my reply answer your question?
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-11-2025 05:51 PM
Hi,
I'm still testing it at the moment and it works at first glance but then tried someone who should work and they were being restricted also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2025 08:21 PM
is there any User Criteria added in "Not available for" related list?
share some more details.
The script I shared should work fine if there is nothing added in "Not available for" related list.
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