You need to sign in to do that
Don't have an account?
Karen Rakoton
Send email in an Apex trigger (on CollaborationGroup) before calling addError
Hi everyone,
I want to have a trigger on ColllaborationGroup (Chatter group) that prevent users from deleting a group, and sending them an email for explanation. This subject was already discussed here (https://developer.salesforce.com/forums/?id=906F00000008xNeIAI) five years ago and I read in many articles all over Internet that this is not possible in one trigger, because when addError is called, "all work done in the trigger, including @future method calls, sending email, queueing batch jobs, or performing any DML, is rolled back".
Can anybody have an alternative solution that could work on the object Collaboration group, knowing that we cannot undelete a Collaboration group? The problem of the trigger, fired before delete, is that the error message is not displayed, probably because of the popup appearing when the user clicks on the "Delete" button. So there is no way the user can know why the deletion is not done. That's one of the reasons the client wants to send an email when someone is trying to delete a group.
I also opened the case #11032475 in Salesforce Support for my problem.
Thans a lot,
Karen
I want to have a trigger on ColllaborationGroup (Chatter group) that prevent users from deleting a group, and sending them an email for explanation. This subject was already discussed here (https://developer.salesforce.com/forums/?id=906F00000008xNeIAI) five years ago and I read in many articles all over Internet that this is not possible in one trigger, because when addError is called, "all work done in the trigger, including @future method calls, sending email, queueing batch jobs, or performing any DML, is rolled back".
Can anybody have an alternative solution that could work on the object Collaboration group, knowing that we cannot undelete a Collaboration group? The problem of the trigger, fired before delete, is that the error message is not displayed, probably because of the popup appearing when the user clicks on the "Delete" button. So there is no way the user can know why the deletion is not done. That's one of the reasons the client wants to send an email when someone is trying to delete a group.
I also opened the case #11032475 in Salesforce Support for my problem.
Thans a lot,
Karen
All Answers