- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:42 AM
How to create User criteria with the script to check whether the logged-in user has any direct reportee who are active and from XYZ location can access the HR catalog
Solved! Go to Solution.
- Labels:
-
HR Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:45 AM
Hi,
use this user criteria advanced script
answer = checkCondition();
function checkCondition(){
var gr = new GlideRecord("sys_user");
gr.addActiveQuery();
gr.addQuery("manager", user_id);
gr.addQuery("location.name", "XYZ"); // give location name here
gr.query();
return gr.hasNext();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:45 AM
Hi,
use this user criteria advanced script
answer = checkCondition();
function checkCondition(){
var gr = new GlideRecord("sys_user");
gr.addActiveQuery();
gr.addQuery("manager", user_id);
gr.addQuery("location.name", "XYZ"); // give location name here
gr.query();
return gr.hasNext();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:50 AM
I wants to know the manager's all direct reportees having XYZ location then it should be visible for manager else not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:51 AM
Hi,
I assume even if 1 active reportee has that location then it should allow access
if yes then script I shared is fine
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2023 04:22 AM
@Ankur Bawiskar @Mohith Devatte Can you please help me with country.
Based on country, Users should restricts for Knowledge Article.