restrict form to direct and indirect reports of an manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 09:33 PM
Hi All,
We have one catalog item that needs to be visible only to the users who directly/indirectly reports to one of the manager.
How can I use user criteria to fulfil this requirement?
I tried searching on community, but didn't find correct solution.
Please help me with any blog if its there
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 10:12 PM
Hi @BijoyDeb ,
In User Criteria you have to click on advance checkbox and write script like below.
var managersys_id='32 bit ID'// call this from system proerty specific manager sys_id
var userID=gs.getUser();
var user=new GlideRecord('sys_user');
user.addQuery('sys_id',userID);
user.query();
if(user.next()){
if(user.manager ==managersys_id){
return true;
}
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 10:23 PM
Not sure what you mean by "directly/indirectly reports to one of the manager" in terms of data in your ServiceNow instance.
Are those users part of a unique Group or Department? If not, you might want to create a new Group for them and setup the User Criteria based on that Group. The scripting option is not the best way to do it as it needs to be evaluated every time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 11:39 PM
@Jim Coyne For example, A is the manager and B reports to A and C reports to B. In that case both B and C should be able to see that catalog item.
This is upto 3 level
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 12:08 AM
Can you create a Group for them all? Or are they, and only them, all in the same Department?