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
hy.lim1.3897974166558203E12hy.lim1.3897974166558203E12 

How to add permission to Salesforce Chatter Collaboration Group sOject?

I have communities enabled in my org and i have a class which will auto add the new registered member to a chatter group.

    CollaborationGroupMember cand = new CollaborationGroupMember(CollaborationGroupId=groupId, MemberId=UserId);
     try {
               insert cand;
                System.debug('Success insert cand >>'+ cand );
         }catch(DMLException e){
             System.debug('There was an error with the invite: '+e);
         }
but when i execute the code it give me this error -> "Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Entity is read-only: CollaborationGroupMember: []"

I am guessing my communities default Guest account doesnt have the right to insert new collaborationgroupmember record. is there a way to extend this permission for this guest profile?

Thanks.
AmitAmit (Salesforce Developers) 
Hello,

Please refer following links for more information :

https://help.salesforce.com/apex/HTViewSolution?urlname=How-to-Silently-add-users-to-Chatter-Groups&language=en_US

https://help.salesforce.com/apex/HTViewSolution?urlname=Insert-users-into-Chattergroups-using-the-Dataloader&language=en_US

https://help.salesforce.com/apex/HTViewSolution?urlname=Chatter-Profile-Based-Rollout-Pilot&language=en_US
ShaneJensenShaneJensen
Did you ever figure out how to get this working, as intended?  Your communities default Guest account adding a new user to the a Chatter Group.