I don't have much experience in the creation of sandboxes. I have a requirement to seed some data from Prod into the sandbox using SandboxPostCopy interface. Is there any way I can do that using SOQL's and SandboxPostCopy interface? If yes, can a sample be provided so that I get an idea on how to do the same.

1 Answer 1


You need to Create an Apex class that implements this interface (SandboxPostCopy). Specify your class during sandbox creation. After your sandbox is created, the runApexClass(context) method in your class runs using the automated process user’s permissions.

Refer this example which show a simple implementation of the SandboxPostCopy interface and a test for that implementation. To test your SandboxPostCopy implementation, use the System.Test.testSandboxPostCopyScript() method.

Reference :- Link

You can also refer this blog

  • 6
    This answer misses what is probably the most important part, "seeding data from production".
    – Derek F
    Oct 8, 2022 at 16:44
  • Yes, Derek. Need some code for seeding the data from Prod. Oct 9, 2022 at 3:13

You must log in to answer this question.

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