1

can you please suggest me how i automate the manual customization after refreshing the new sandbox from the production to remove some production setting through apex class.

Noe a days in latest refresh there is an option to give the apex class it will automatically to the needful setting in the newly fresh sandbox,

Bit the problem is how i start writing that Apex class,

Or, is there any other method to solve the problem, please help me i am new in salesforce, but i am very eager about salesforce automation. please help me.

1 Answer 1

2

Run Script After Sandbox Creation and Refresh

To make your sandbox environment business ready, automate data manipulation or business logic tasks. At sandbox creation, specify a single Apex class to perform the tasks. This class executes every time the sandbox is copied.Lightning interface of sandbox post-copy script specification

Create an Apex class that implements SandboxPostCopy and specify the class here. For example, the following Apex class simply reports the three contexts available in SandboxPostCopy: your organization ID, sandbox ID, and sandbox name:

global class HelloWorld implements SandboxPostCopy {

  global void runApexClass(SandboxContext context) {

      System.debug('Hello Tester Pester ' + context.organizationId()
           + ' ' + context.sandboxId() + context.sandboxName());
  }
}

// Test Class

@isTest
class testHelloWorld{

    @isTest
    static void testSandboxPostCopyScript() {

        HelloWorld apexclass = new HelloWorld();
        Test.testSandboxPostCopyScript(***apexClassName***, 'orgID', 'sandboxID', 'sandboxName');
        System.assertEquals(1,1,'Test something');
    }
}

References

1
  • Hi devendra, thanks for your quick response one more thing how I will change the hardcoded thing from the apex class like in production mail id is [email protected] and after refresh I want [email protected] how I will do this using test automation . please help Commented Jul 18, 2016 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .