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
Kirtish ShrotriyaKirtish Shrotriya 

how to get public groups list from our org

I want list of public groups in my org but as I am quering [select id , group.name from group] it's giving me a list  with some other records as well as I've created only one group it should show only one record but it's showing  queues record, public group records, and some other records.

Please help.
Best Answer chosen by Kirtish Shrotriya
Shruti SShruti S
Please try the following query:
SELECT Id, Name FROM Group WHERE Type = 'Regular'
Please note that Group object stores different types of groups such as Public Groups, Queues etc. You can use the Type field to uniquely identify the ones you are looking for. Please refer the different types here: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_group.htm

All Answers

Shruti SShruti S
Please try the following query:
SELECT Id, Name FROM Group WHERE Type = 'Regular'
Please note that Group object stores different types of groups such as Public Groups, Queues etc. You can use the Type field to uniquely identify the ones you are looking for. Please refer the different types here: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_group.htm
This was selected as the best answer
Naveen PoojaryNaveen Poojary
Hi kritish,

You have to use the Query Like this to retrieve public groups:
SELECT Id,Name,CollaborationType FROM CollaborationGroup WHERE CollaborationType = 'Public'
Please make it as best answer if it solves your problem