I want to have a trigger on ColllaborationGroup (Chatter group) that prevent users from deleting a group, and sending them an email for explanation. I read here and here and here 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? I was thinking on saving all the data of the group in a file, then letting the user delete the group and sending the email, (all in a before delete trigger), and in an after delete trigger, restore the group with the file.

Thanks a lot,


@Peter : Thanks for your comment. The problem of this trigger 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.

PS : I also opened the case #11032475 in Salesforce Support for my problem

  • 1
    You are correct that this is not possible. But sending an email for validation failure seems like overkill at first glance.
    – pchittum
    Sep 29, 2014 at 16:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.