You need to sign in to do that
Don't have an account?
Jesus G
Test class SandboxPostCopy Interface
Hello!
Please, could you help me to write the test class for this code where I am using the SandboxPostCopy interface to modify an account field after refreshing a sandbox? I have tried by creating a test class that updates Account records but the code coverage is 0...
Thank you very much!
J
Please, could you help me to write the test class for this code where I am using the SandboxPostCopy interface to modify an account field after refreshing a sandbox? I have tried by creating a test class that updates Account records but the code coverage is 0...
global class AfterSandboxRefresh implements SandboxPostCopy { global void runApexClass(SandboxContext context) { List<Account> listOfAccounts = new List<Account>(); List<Account> accountsToUpdate = [SELECT Id, Email__c FROM Account WHERE Email__c != NULL AND Email__c Like '%_@__%.__%']; if(!accountsToUpdate.isEmpty()) { For (Account acc : accountsToUpdate) { Email__c = Email__c + '.noemail'; listOfAccounts.add(acc); } Database.Update(listOfAccounts, false); } } }
Thank you very much!
J
Thanks
Amit Chaudhary
All Answers
Thanks
Amit Chaudhary
Many thanks for your reply! It worked perfectly :)
I already checked the documentation and I was trying something very similar but I was not specifying the parameters properly.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interface_System_SandboxPostCopy.htm
Thank you,
J
Can anyone please help on how can we execute the apex class in anonymous window.I am also writing similar apex class.Thanks