7

when I'm within a chatter group I can do two things:

  1. Add a group member
  2. Invite people

I know how to add a group member via Apex code, however I need to invite people to join this group through an email, but I cant find how to accomplish this with Apex.

0

1 Answer 1

5

You can do this in Apex by inserting a CollaborationInvitation

String emailAddress = '[email protected]';
CollaborationGroup chatterGroup = [SELECT Id 
      FROM CollaborationGroup 
      WHERE Name='All acme.com' 
      LIMIT 1];
CollaborationInvitation inv = New CollaborationInvitation();
inv.SharedEntityId = chatterGroup.id;
inv.InvitedUserEmail = emailAddress;

try {
   Insert inv;
} catch(DMLException e){
   System.debug('There was an error with the invite: '+e);
}
1
  • Is this example relevant for inviting customers? Jan 21, 2016 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .