Get Number of Active Users In a Public Group Using SOQL Query

SQOL Query:

SELECT COUNT(Id) FROM User WHERE Id IN (SELECT UserorGroupId FROM GroupMember WHERE Group.Name = 'Support Group') AND isActive = true

Note: Change the Group Name as per your requirement.

  • David de León

    Thank you!
    I only have to note that this approach won’t work if your public groups are defined by roles for example. This query would only return groupIds representing the roles, but no the actual user’s Ids.