• Aaron Winters 24
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I'm an administrator for two orgs (one on na2 and one on na27) and I haven't been able to get a class based on the new SandboxPostCopy interface to execute on sandbox refresh for either org. At this point I am trying to see if I can even get a simple script to execute on refresh. The class, test class and refresh steps are below. Am I missing something?

SandboxPostCopy class:
global class HelloSandbox implements SandboxPostCopy {
    global void runApexClass(SandboxContext context) {
        Account a = new Account(Name='Acme');
        insert a;        
    }
}
This code executes fine with Execute Anonymous.

This is the test class:
@isTest
class HelloSandboxTest{

    @isTest
  static void testSandboxPostCopyScript() {
    HelloSandbox apexclass = new HelloSandbox();
    Test.testSandboxPostCopyScript(apexclass, UserInfo.getOrganizationId(), UserInfo.getOrganizationId(), 'dev');
    System.assertEquals(1,1,'Test something');
  }
}
Where the development sandbox is named "dev". This covers 100% of code in the related class.

This is what I enter in the Create Sandbox step of the refresh process:
User-added image
Thanks very much in advance!
Aaron