Tuesday, February 09, 2016

Salesforce Sandbox Templates and Post Refresh Scripts

With Salesforce Spring 16 release,

we are getting a nice hook to tag an Apex Class to run every time a sandbox gets refreshed..

Typically Salesforce Administrators or Release management teams, goes thru series of steps every time a sandbox is created or refreshed. Salesforce helped them to some extent by bringing in sandbox templates before.. taking it a step further, now they have added the ability to auto run an Apex Class once the sandbox is ready..

This feature is highly useful when we bring in data from production to a sandbox and if

  • we have to scrap or mask certain fields of certain objects 
  • to meet the enterprise data standards policy / be data complaint 
  • protecting customer's privacy data and also 
  • avoiding any automation in non production environments impacting customers.

Until spring 16, we used to run batch jobs to perform tasks like data cleanup, masking, scrapping etc.. from now on we don't need to run the batch job manually. we can include all the logic into an Apex class and

  • either include that Apex class into a sandbox template if its for a partial or full sandbox

  • or directly specify the apex class if its a developer or developer pro sandbox

This feature will be more useful with Partial and Full sandboxes compared to Developer & Developer Pro sandboxes since we don't get any data being copied across with these 2.

With the increased number of sandboxes available for the latest editions of salesforce, this is definitely a time saver for larger development teams using multiple sandboxes and going thru frequent refresh cycles in a project release.

here's the link to the release note page with details..

Spring 16 Sandbox Post Copy Scripts

No comments: