rogeramitchell / sandbox-post-copy-tasks

Automates logic when creating a sandbox copy from prod within Salesforce.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sandbox Post Copy Tasks

As part of the Spring '16 release, Salesforce allows admins to run a block of Apex after a sandbox copy has finished. This is particularly helpful for automating tasks in Developer and Developer Pro sandboxes, which both do not feature partial / full data copies from production. But most importantly, there's no need to reset the other system administrators and developers email addresses (provided you run these scripts).

Technical Details

SandboxTaskAutomation.cls leverages the SandboxPostCopy interface to call methods from the runApexClass method. The one method that we have defined is the resetActiveAdminUserEmails, which retrieves any active system administrators and updates the email address for that user if their email address contains example.com.

TODO: Assert Functionality Works as Expected

Even though SandboxTaskAutomation.cls has 100% coverage from SandboxTaskAutomationTest.cls, it does not appear that Salesforce provides a way to assert the actual outcome of logic meets the expected results. If you have an idea of how to properly test this, I'd love a pull request or issue to this repo, or a mention @RogerMitchell on Twitter.

About

Automates logic when creating a sandbox copy from prod within Salesforce.


Languages

Language:Apex 100.0%