Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Report On Group Member Count

smithro
Tera Guru

What is the easiest way to build a query that tells me how many active members are in a Group?  We have hundreds of groups, so this would be a helpful admin tool.  I think ideally I'd like an integer field on the group table that counts number of active members.  From there I could add the field to the group list view for sorting.  The field would also need to display a zero for those groups with no active members.  

1 ACCEPTED SOLUTION

Hi @smithro , 

Correct. The first response I added will provide Groups that have Zero Group Members associated to them.

Thank you,

Josh Pirozzi

View solution in original post

11 REPLIES 11

Josh Pirozzi
Kilo Sage

Hello @smithro , 

 

You can build a report for Groups that have Zero users by:

  • Setting the Data Table to sys_user_group
  • Setting your condition(s) to: Active = True
  • Setting your Related List Conditions to:
    • Less than 1
    • Group Members

 

Thank you @Josh Pirozzi ! This helped me

Josh Pirozzi
Kilo Sage

Hello again @smithro ,

 

Then, to get a report of the Count of Group Members, you can:

  • Set the Data Table to sys_user_grmember
  • Set your condition(s) to: Group.Active = True
  • Set the Report Type to Pivot Table
  • Set the Row under Configuration to Group.Name
  • Set the Aggregation under Configuration to Count

This gets me close to what I need, but if a group has zero members it doesn't show up on the report.  

Hi @smithro , 

Correct. The first response I added will provide Groups that have Zero Group Members associated to them.

Thank you,

Josh Pirozzi