Use caution when refreshing a FULL sandbox.

One of the great benefits of working with the salesforce platform is the ability to quickly and easily spin up a sandbox or test environment.  Salesforce provides a number of different types of sandboxes.  Each type can serve a different purpose based on what you are trying to build or test.  One of the most helpful types of sandbox is the "FULL" sandbox.  This is an exact copy of your production environment which means your data is copied in it's entirety to the sandbox org.  The benefits of this type of sandbox include the ability to test various pieces of functionality with a large production like data set.  You are able to refresh a full sandbox every 30 days but there are a few things to keep in mind when you refresh.

One of the biggest risks of using production data is that it is just that, production data.  These are real contacts with real email addresses and phone numbers etc.  When a sandbox is refreshed salesforce automatically concatenates all user email addresses and usernames with the sandbox name.  For example, if my username was it would be updated to be  This is a very helpful feature which prevents you from emailing users accidentally from your sandbox.  The danger is around the contacts that are cloned/created in your full sandbox.  Salesforce does NOT concatenate these email addresses so they are the same as the REAL email address that was in production.

So what do we do?  Salesforce has a built in "switch" for turning on and off the ability to send emails from a sandbox or production org.  You can find this switch under Setup>Email Administration>Deliverability.  It should look like this.

The options are "No Access" which means email will not be sent from the org at all, "System email only" which means only password reset type of emails will be sent out, and "All email" which means all email will be sent including workflow email. 

By default when a sandbox is refreshed this should be set to "System email only".  This is to prevent the issue I'm describing.  However, what if I need to test workflow rules that send emails?  I'll need to turn this to "All email" and the risk of emailing a real contact is back in play.

There are two ways to handle this.  If you have a really large number of contacts then I would recommend doing an export using the data loader.  This will give you a csv file with all of your contacts.  You can simple change the email addresses and do an update also using the data loader.  If you have a smaller more manageable number of contacts you can simply open the developer console and execute a simple update script.  If you are not familiar with apex you will need some assistance from a developer to write this script.  One final word of caution on using the developer console to update records.  With great power comes great responsibility.  The developer console can be very helpful when you need to update a set of records but it has the power to update and delete any records in your org.  Double check your script before you execute it to be sure you're updating what you are intending to update.

To summarize, keep an eye on your contact emails when you refresh your full sandboxes and be sure to update them if you plan on testing workflow email functionality from your sandbox.  Hopefully this will save you from accidentally emailing your contacts.


What is this GrefTech blog all about?

These are exiting times for GrefTech Inc.!  As the company gets going I (Joe) am excited to be able to connect with my colleagues and clients via the blog here at  So what should you expect from the blog?  I am a techie at heart so the blog will contain a combination of tips, tricks, and best practices revolving primarily around the platform and my experiences developing on it.  I'll also write about the latest news and trends in the cloud computing marketplace.  Finally, there will also be an occasional client spotlight.  Please feel free to comment on posts and leave feedback.  Until next time. is LIVE!

Today is an historic day for GrefTech Inc.  The website is now live and GrefTech has an online presence!  Many thanks to Michel and Kim van Essen of VAN ESSEN STUDIO ( for the design and development of the site as well as the logo.  If you have more questions about what GrefTech does or would like more information about the services that are available please use the CONTACT link at the top of the site to reach out.