When I refresh some Sandbox the users are copied with the email emailname=domain.com@example.com, I need the correct email in the sandoxes.
I tryed using a class that run after the sandbox refresh using the following option:
And I used the following class:
global class Sandbox_Refresh implements SandboxPostCopy {
global void runApexClass(SandboxContext context) {
List<User> UserList = [SELECT Email FROM User where Email LIKE '%@example.com%'];
for(User u : UserList){
u.Email = u.Email.replace('@example.com', '').replace('=', '@');
}
if(!UserList.isEmpty()){
update UserList;
}
}
}
This class was executed without problems. But the email's users was not update how we expected.
Are there some way to update this emails after the refresh a Sandbox?
Regards
2 respuestas
You can do this simpy via dataloader,just use formula to replace the pattern in the email column and update via dataloader.Check here :
Mass updating users' email address and username