Our requirement is to update customer's email ID and Phone# to an invalid value in FullCopy sandbox during the sandbox refresh. Using PostSandbox refresh apex class we are updating the User email and other values but here the request is for customer's data update (million records). Business is asking this update to avoid the condition where an email has been triggered to the Customer from sandbox.

Please suggest if anyone has done this before. Thanks.


Yes, We use to do data loading for all the email fields in our org for full copy sandbox by extracting all the object record which possibly contain an email field. In case you want to skip these extra stuff, You do write an informatica job to mask it.

Another option you have is :-

Run Script After Sandbox Creation and Refresh - To make your sandbox environment business ready, automate data manipulation or business logic tasks.

 global class HelloWorld implements SandboxPostCopy {
  global void runApexClass(SandboxContext context) {
      System.debug('Hello Tester Pester ' + context.organizationId()
           + ' ' + context.sandboxId() + context.sandboxName());

Reference :- https://releasenotes.docs.salesforce.com/en-us/spring16/release-notes/rn_deployment_sandbox_postcopy_script.htm

The point and click functionality is not yet available. An idea has been created to deliver this:- Masking sensitive data after refresh of sandbox

  • Thanks for the reply Sanket. Data Loader is obviously one option and in Sandboxpostrefresh interface mainly need to know the total time taken.There is no ETA on sandbox refresh from Salesforce side and full copy sandbox already takes longer time and now millions of data update....
    – HRZ
    Dec 9 '18 at 23:31
  • can SandboxPostCopy call into batchable?
    – NSjonas
    Jul 9 '19 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.