I need an approach to allow delegated admins (i.e., non-Administators) to add members to Public Groups and Collaboration Groups (the GroupMember and CollaborationGroupMember objects).
I added a custom object (UserGroupRequest__c) to capture which Users should be added/removed to which Groups.
I've also built a batchable class to process the requests.
However, GroupMember is a Setup object, and CollaborationGroupMember is not. So this doesn't work if I combine the operations in a single batchable class.
Should I instead be using 2 batch classes, calling one from the finish method of the other?
Any recommendations on how best to proceed? Am I way off base?
Would a trigger on the Request object perhaps be better? I'm guessing that there may be a permission problem if this is attempted via a trigger as the delegated admins won't be able to add users to public Groups. Also, I'm guessing the trigger approach would run into the same mixed DML issue - on Insert of the Custom object, I would need to Insert/Delete from GroupMember and from CollaborationGroupMember, and then perform a 2nd update on the Custom object to indicate that processing was completed...
@future
I think.