- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2017 04:27 AM
We need to find the best way to see which users are in the system that are not assigned to any group. Is there a way to report on this?
I've looked at making a report against the sys_user table but then can't find a column for group to report against?
Any help would be greatly appreciated.
Thanks
Solved! Go to Solution.
- Labels:
-
Reporting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2017 04:31 AM
I would do a background script, something like:
var user = new GlideRecord('sys_user');
user.addActiveQuery();
user.query();
while(user.next()){
var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('user', user.sys_id);
grmember.query();
if(!grmember.hasNext()){
gs.print(user.getDisplayValue());
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2017 04:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2017 07:41 AM
If you were using the ODBC connection you could also do something like this:
Select
OAUSER.sys_user.name
From
OAUSER.sys_user
Where
OAUSER.sys_user.sys_id not in
(Select OAUSER.sys_user_grmember.user
From OAUSER.sys_user_grmember)
We do something similar quarterly in our audits...
ML
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017 07:20 AM
With Explore Analytics, you can do this without code in real time.
You create one pivot report on the group table with all the groups:
You create another pivot report on the group member table, showing the number of users per each group:
Then you use the Explore Analytics 'mash-up' feature to combine the two reports:
The result will look like this, with all of the groups, and the number of users associated to them (and blank for ones with no users):
Then, all you need to do is use the Explore Analytics 'output filter' feature to show only the groups with no users:
Because Explore Analytics queries ServiceNow in real time, you can now present that information in dashboards or in a scheduled job with the real-time data.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2020 07:27 AM
I believe you can accomplish this with Related List Conditions. Just rebuild the report in this screenshot.
I ran it, got one number of results.
Then, I added one of the users in the list of results to a group.
Finally, I ran it again and got exactly 1 less result as last time. I think it's working. I hope that helps, have a wonderful day!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2020 01:38 PM