function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KaityKaity 

SOQL on Chatter

Hi, 
Can some one would help me on-  What is the SOQL for retrieving the list of Users who are Moderators in a Private or Public Group?

​Thanks,
Kaity
Andy BoettcherAndy Boettcher
You're looking at the CollaborationGroupMember table - check and try this out first, let us know if you need further assistance.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_collaborationgroupmember.htm
KaityKaity
Hey Andy,
I have read that but did not get much luck.
My use case is- In our organization there are various Private Groups are there. I need to know who are Moderators,owners and Managers are there for each Private and Public Group.

Basically, I am looking for the SOQL query. 

 
Andy BoettcherAndy Boettcher
The CollaborationGroupMember table has CollaborationGroupId (your chatter group) and CollaborationRole, a picklist of "Standard" and "Admin".  "Admin" = Manager.

The "Owner" of the group is the CollaborationGroup.OwnerId.

SOQL would roughly be SELECT Id, Owner.Name, (SELECT MemberId, CollaborationRole FROM CollaborationGroupMembers)