- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 08:52 AM
I just ran this and it seemed to work:
var gr = new GlideRecord('sys_user');
gr.addActiveQuery();
gr.query();
var count = 0;
var x = gr.getRowCount();
var curuser = gs.getUser();
while(gr.next()){
var user = curuser.getUserByID(gr.user_name);
if(user.hasRole('view_changer')){
gs.print("** " + gr.name + " has role");
count++;
}
}
gs.print("** Found " + count + " users out of " + x + " with role.");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 09:25 AM - edited 02-11-2025 09:26 AM
Find all roles that contain view_changer
Navigate to sys_user_role_contains.list and search for the role view_change
Find all groups that contain view_changer
Navigate to sys_group_has_role.list and search for the role view_change OR whatever roles you identified that contain the role
Find all users that have the view_change role
Navigate to sys_user_has_role.list and search for the role view_change OR whatever roles you identified that contain the role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 03:28 AM
Thanks a lot it was very helpful in my final solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 06:49 PM - edited 02-11-2025 06:50 PM
Hi @juancarrion ,
You need to fetch data from tables and then filter based on need.
Get the list of role(s) which contains this view_change role from table "sys_user_role_contains"
Get the list of User who has this role, either direct or through group and inherited & inheritence count will explain that. You will get the Contained By and Group both the count here.
-Thanks,
AshishKM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 08:40 PM
share the script you are using