How to reactivate a user with success?

Once you deactivate a user, all it’s groups relations and teams – are deleted.

enter image description here

Is there a way that once you reactivate it, he will be returned to the groups he once was in?


EDIT : I read your question as Chatter Groups, whereas you meant Sharing Groups I reckon.
Chatter Groups are in fact restored when you reactivate the User, I’ve just tried this. Can’t remember know why I thought the Chatter Group Memberships were not restored when the User was reactivated.

I don’t believe there is way to seamlessly do this.

Group Memberships are held in the CollaborationGroupMember object. You can extract records from this where MemberId=UserId you are about to deactivate.

When reactivating the user, you can then insert the backed up CollaborationGroupMember records.

Untested suggestion :
Maybe there is a way to automate this, a User Before Update trigger copies the CollaborationGroupMember records to a shadow object if isActive is changing from Active to Inactive.

If changing from InActive to Active, an After Update trigger on User reinserts the CollabrationGroupMembers records (queried from the shadow object where MemberId__c = User.Id) thereby restoring the Group Memberships. (It should ideally also delete all back up records for that User at this point do that a fresh backup can be taken when the User is deactivated next)

It’s worth keeping in mind that there be some Chatter External Users who you wouldn’t want to resurrect back into the same External Private Groups, as those memberships may no longer be relevant. Also potentially instances where users have moved on from one company and were registered with a for eg address and when they are being reactivated as an employee of another company, they shouldn’t get back all group memberships which they had by virtue of being employed at the previous employer.

Source : Link , Question Author : Saariko , Answer Author : techtrekker

Leave a Comment