Newer Version Available
SandboxPostCopy Interface
To make your sandbox environment business ready, automate data
manipulation or business logic tasks. Extend this interface and add methods to perform
post-copy tasks, then specify the class during sandbox creation.
Namespace
Usage
Create an Apex class that
implements this interface. For example, the following Apex class reports the
three contexts available in SandboxPostCopy: your organization ID, sandbox ID, and sandbox
name:
1global class HelloWorld implements SandboxPostCopy {
2 global void runApexClass(SandboxContext context) {
3 System.debug('Hello Tester Pester ' + context.organizationId() + ' ' + context.sandboxId() + context.sandboxName());
4 }
5 }SandboxPostCopy Example Implementation
This is an example implementation of the System.SandboxPostCopy interface.
1global class HelloWorld implements SandboxPostCopy {
2 global void runApexClass(SandboxContext context) {
3 System.debug('Hello Tester Pester ' + context.organizationId() + '
4 ' + context.sandboxId() + context.sandboxName());
5 }
6 }The following example tests the implementation:
1@isTest
2 class testHelloWorld{
3 @isTest
4 static void testSandboxPostCopyScript() {
5 HelloWorld apexclass = new HelloWorld();
6 Test.testSandboxPostCopyScript(apexClassName, 'orgID', 'sandboxID', 'sandboxName');
7 System.assertEquals(1,1,'Test something');