function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mahalakshmi kothurimahalakshmi kothuri 

Deployment Group members to Public Group

Hello,

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,

Greetings!

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

https://www.infallibletechie.com/2013/08/how-to-add-users-to-public-group-using.html

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.