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
Amiya Das1410Amiya Das1410 

Creating Chatter group for community users via Apex?

Hi Folks,

I have a scenario to restrict a community user from creating more than 1 private chatter group. Trigger has been created for this. Now while covering the trigger handler class via test class, I am facing the issue on how to create a chatter group for community users via apex. Is this a constraint??
Any suggestions or workarounds for this.

Thanks
Khan AnasKhan Anas (Salesforce Developers) 
Hi Amiya,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

https://salesforce.stackexchange.com/questions/18666/how-to-dynamically-creating-chatter-groups-in-apex

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_ConnectAPI_ChatterGroups_static_methods.htm?search_text=chattergroups

https://salesforce.stackexchange.com/questions/94434/programmatically-create-chatter-group-and-associate-a-group-record-to-it

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas