We have a sandbox that is partial. It would appear that the refresh did not bring down everything it was supposed to in order for the instance to work properly.

I'm currently working on a batchClass that will update old Opportunities to Closed Lost, but when doing some tests on sample records, Salesforce will fail with an internal server error.

I'm not sure what the best practice approach would be to continue validating my app, but have come up with these 3 options:

  1. Create a Formula Field that is CreatedDate - 7 and run my tests off that to validate that the records are updating correctly in the UI. Then when I write test classes and methods change the query to use CreatedDate and use Test.SetCreatedDate Method that was implemented in 16' releases.

  2. Just write the test classes and if they pass, then we should be good to go.

  3. Apparently you could import data in via the dataLoader and get the CreatedDate set that way if the Audit Fields setting is activated.

Am I missing an option? Is 2 the best approach?

  • 1
    I typically put in a support case with Salesforce for these types of errors in partial after a refresh and they run a "scrutiny" that fixes it. It might be worth doing that vs. coding to avoid partial issues. – Kris Goncalves Sep 22 '20 at 13:32

Your Answer

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

Browse other questions tagged or ask your own question.