+ Start a Discussion
mahalakshmi kothurimahalakshmi kothuri 

Deployment Group members to Public Group


I am trying to move the five group Members (who are Role-based users) in a group to a different sandbox and this is a one-time job.

So I saw data loader solution which is not supported by my company process. So can someone please help me with the script that I can run the developer console?

Design: In a Group, there are 5 different role-based users who are added and need to move to diff org. 
Thank you in advance.

ShirishaShirisha (Salesforce Developers) 
Hi Mahalakshmi,


Please check the sample code in this blog on how to add the members to the group:


Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
mahalakshmi kothurimahalakshmi kothuri
Hi Sirisha, Thank you for your reply.

In that thread, the code is for new users adding the group. But I am looking for roles to add to the public group.

Also, UserOrGroupId in the code can refer to the User or Group, not the role. So I am looking for help on how can we add the roles to the group.

Thank you for your time.