
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 01:04 AM
Hello ServiceNow community, I have a requirement to know who from the active users we have is not a member of a group with type "ITIL" (Type is an out of the box field on the group table.
we are on Helsinki Patch 11
Thanks a lot.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 02:06 AM
Hi Ahmed,
You can pull all users who are not mapped to any group using the following method.
1. Create a script include and place the below function in it.
script:
*************************
*****************************
2. Create a report on 'sys_user' table and call the script include function in the report filter. Please refer the below screenshot. On running the report, you'll get the list of users who are not member of any group.
Similarly, you can use the below script to fetch the list of users who are member of non ITIL type group.
-Udhay
Please Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 02:39 AM
Once done you can get the extract of Users from sys_user_grmember table get Unique value for Users & then go to User table & filter with User.Name is not one of (with the list of Unique users you got form sys_user_grmember table).
That in turn would suffice what is expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 02:04 AM
Hi Ahmed,
Navigate to Group Member list view using sys_user_grmember.list and then use the filter which i have highlighted in the below screenshot.
This will provide you the list of active users who are not members of ITIL type group.
-Udhay
Please Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 02:31 AM
Thank you very much Udhay for your solution,
The group sys_user_grmember table contains users who already have a group, but my issue is to get the users who don't have a group or the group type is not itil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 02:44 AM
add this as a script include and amend your filter to sys ID is not javascript:findUsers()
findUsers();
function findUsers(){
var arr = [];
var gr = new GlideRecord("sys_user_grmember");
gr.query();
while(gr.next()) {
arr.push(gr.user.toString());
}
return arr;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 04:46 AM
Thanks, David,
I have tried this method and I have created the query (filter) on the sys_user table but it didn't work, it got me all the users on the user table. so I think their is something wrong.