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
Punam ChakrabortyPunam Chakraborty 

Trigger on Chatter group members

Hi all

I want to write a trigger on chatter group members. It will work when a new member will be added to the group and everyone will be notified through email. How can I write a trigger for this?
Best Answer chosen by Punam Chakraborty
AnjithKumarAnjithKumar
Hello Punam,

You need to write after insert trigger on CollaborationGroupMember object.

Sample code;
trigger CollaborationGroupMemberTrigger on CollaborationGroupMember (after insert) {
	//get all group id from CollaborationGroupId
	//Query all group members from the group
	//send email to members
}

Hope it helps you.

Thanks,
Anjith
 

All Answers

AnjithKumarAnjithKumar
Hello Punam,

You need to write after insert trigger on CollaborationGroupMember object.

Sample code;
trigger CollaborationGroupMemberTrigger on CollaborationGroupMember (after insert) {
	//get all group id from CollaborationGroupId
	//Query all group members from the group
	//send email to members
}

Hope it helps you.

Thanks,
Anjith
 
This was selected as the best answer
Punam ChakrabortyPunam Chakraborty
Thanks AnjithKumar. I have done exactly like this and it is working perfectly.