I have implemented an apex method that prevents a certain profile (let's call it A profile) from being removed from a Collaboration Group. The apex code works fine but I don't know if there's a way to show a custom message after the user clicks the (x) icon (see screenshot below, besides the Manager word).
The code is simple, a method called in a before delete trigger on CollaborationGroupMember object checks the profile of the member to be deleted and should throw an error message if the member's profile is A. The problem is that using addError on User, CollaborationGroupMember or CollaborationGroup objects throws an exception sObject does not allow errors. And, as long as I know, I can't use a Visualforce page since that (x) button can't be replaced.
Thanks for your help.