I am trying to create class that can be used post sandbox refresh and I am getting Invalid Interface:SandboxPostCopy error when trying to save.

Below is the code that I am using.

global class SandBoxPostCopy implements SandboxPostCopy  {
    global void runApexClass(SandboxContext context) {
        insert new Account(name = 'Context Org Id: ' + context.organizationId() + 
                ' Context Sandbox Id: ' + context.sandboxId());
        insert new Account(name = ' UserInfo Session Id:  ' + UserInfo.getSessionId() + 
                ' UserInfo Org Id:  ' + UserInfo.getOrganizationId());
        insert new Account(name = ' Organization IsSandbox: ' + 
                [SELECT IsSandbox FROM Organization].IsSandbox);

Please assist.

1 Answer 1


If you notice closely, name of your custom class and Salesforce interface are same; thus confusing the compiler.

global class SandBoxPostCopy implements SandboxPostCopy

Rename your class appropriately to get rid of that error.

  • Hi Rahul, Thanks for the Relpy. I changed the class name and still the same error.
    – sfdcdev
    Aug 22, 2017 at 6:16
  • Could you please edit your question and add updated code with error?
    – Raul
    Aug 22, 2017 at 6:18
  • Issue resolved. I logged out, closed the browser and tried again and that worked. Thanks Rahul.
    – sfdcdev
    Aug 22, 2017 at 10:43

You must log in to answer this question.

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