- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 09:30 AM
As SN administrator, I want to list all queue groups with number of group members in the system, set a field for number of members and order the data by count so that I can find number of members in group. Also I want to be able to set categories of large and small numbers of members if possible.
Where in ServiceNow that I can create that data view and I believe I can use SQL script using "having" clause?
Here is mock example desired to be on list sort on count(number of members),
GJK-QUEUE NAME-IT-SYSTEM(25) <--- 25 is number of members.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 12:15 PM
I have found a way to be able to sort out list based on number of members is by creating a new field for total number of members.
First, I create a 2 new columns in sys_user_group like Total of Group Member and Total of Active Group Member.
Second, I create a script in Scheduled Job to run and populate data in 2 new columns to show results number of members. Screenshot show below
Third, I create a report based on group and show list of group name, total of group members, and total of active group members. Now I can sort out the numbers. Here screenshot example,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 09:46 AM
Hi Bradley,
You can sort of do this using a pre-built join, the Groupmember [sys_user_grmember] table.
The UI of ServiceNow reporting is a little constrained, but here's an example as a pivot:
Or as a grouped list:
In both cases, you can't really sort based on the number of group members, or group them by number of members. You can do that with Explore Analytics.
Here's an Explore pivot grouped from largest to smallest groups:
And here's the # of groups grouped by how many members the groups have (there are 4 groups with 8+ members, for example):
Explore Analytics can also do on-the-fly joining without requiring SQL, although I don't think you'd need it here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 10:45 AM
So there is no way to sort out by number of members using SQL query in ServiceNow or do alternative way with plugin without paying monthly like Explore Analytics?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 10:51 AM
ServiceNow doesn't allow SQL querying. Through script, you could use the GlideAggregate API to query:
GlideAggregate - ServiceNow Wiki
But there isn't a UI for displaying it that I'm aware of, unless there's something I've missed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 11:32 AM
Couldn't you add a member count field to the group table and a business rule on the group membership table that runs on insert and delete and sets the field to the count?
You'd have to run a fix script to initially get the numbers, but it should stay green after that.