-
-
Save mhamzas/534b7da9a3ca6a7fea32c7cd5f50065a to your computer and use it in GitHub Desktop.
Apex SandboxPostCopy example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global without sharing class SandboxPostCopyUpd implements SandboxPostCopy { | |
global void runApexClass(SandboxContext context) { | |
LIst<Contact> ConList = [SELECT ID FROM CONTACT]; | |
for (Contact con : ConList) { | |
con.Email = '[email protected]'; | |
} | |
update ConList; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@isTest | |
public class SandboxPostCopyUpd_test { | |
static testMethod void testSandboxPostCopyScript() { | |
Account acct = new Account (Name='Acme'); | |
insert acct; | |
Contact con = new Contact (FirstName='Yamada',LastName='Taro',AccountId=acct.Id,Email='[email protected]'); | |
insert con; | |
Test.testSandboxPostCopyScript(new SandboxPostCopyUpd(), '00D000000001111', '00D000000002222', 'sandboxName'); | |
System.assertEquals(0,[SELECT count() FROM CONTACT WHERE Email !='[email protected]']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment