A Salesforce Sandbox environment enables you to test new configuration, code, and automation outside of your production (live) instance – it’s like a replica of your production instance with some or all of your metadata and data depending on your sandbox type (which we’ll explore shortly!).
This article includes everything you need to know about sandboxes, including the different types and how to use them – we’ll be taking a look at sandboxes in a Salesforce context.
Key Terms
These key terms will help your overall understanding of Salesforce Sandboxes.
- Metadata is your Salesforce configuration data such as Fields, Layouts, Profiles, and Automations.
- Data Storage relates to how much space there is for Salesforce records.
- File Storage defines how many files (e.g. documents, images, etc.) can be stored.
- A Sandbox Type relates to the different sandbox options which have different Data Storage and Refresh Intervals.
- Refresh Interval defines how often you can update a sandbox from production.
- A Sandbox Template defines what Salesforce records are copied into the new sandbox.
What Is a Salesforce Sandbox?
A Salesforce Sandbox is a test environment that provides a way to copy and create metadata from your production instance – it is a separate environment where you can test with data (Salesforce records) including Accounts, Contacts, and Leads.
It is considered best practice to configure and test in a sandbox prior to making any live changes; this ensures that any development doesn’t disrupt your live environment and isn’t rolled out before it’s been thoroughly tested.
The data that is available to you is dependent on the sandbox type. There are multiple different types and each has different considerations. Some sandbox types support, or require, a sandbox template.
Sandbox Types
There are four types of sandbox, each with its own set of characteristics that make it fit for a specific purpose. Each sandbox type has a few different variables to consider:
- How often you can refresh a sandbox to mirror your production instance.
- How much information you can store across data storage and file storage.
- Whether just metadata or data is copied over.
- Which Salesforce editions include which sandbox types.
1. Developer Sandbox
The most basic type of testing environment is the Developer Sandbox. These are included with most Salesforce licenses and allow you to create a testing environment with a copy of your metadata from production.
Developer Sandboxes can be refreshed once per day, and have a data and file storage limit of 200MB each.
2. Developer Pro Sandbox
Developer Pro Sandboxes are very similar to standard developer environments but have slightly higher storage limits. They provide you with 1GB for both data storage and file storage, and the refresh limit is one day.
Developer Pro Sandboxes are only included with Unlimited and Performance editions of Salesforce, but can be purchased separately.
3. Partial Copy Sandbox
This is the first type of sandbox that allows you to not only copy metadata, but also a portion of your data. As the name suggests, you can select a sample set of data using a sandbox template.
This sandbox is very helpful if you wish to test new functionality on live data, or if you wish to train users using live data in a test environment.
Partial Copy Sandboxes are included with Enterprise, Unlimited, and Performance edition Salesforce licenses, and can also be purchased separately.
The Partial Copy Sandbox has a refresh interval of five days, and allows data storage up to 5GB, with file storage mirroring that of your production org.
4. Full Sandbox
A full copy sandbox copies all of your production metadata and data. This gives you an exact replica of your production instance in order to fully test functionality, as well as train new users.
Full Sandboxes have a 29-day refresh interval, and mirror the storage limits of your production org for data and file storage.
These sandboxes are only included with Unlimited and Performance editions of Salesforce, but can be purchased separately.
Salesforce Sandbox Templates
A sandbox template enables you to choose specific objects and data to copy into your sandbox. Note that sandbox templates are only available with Full and Partial Copy Sandboxes.
If the sandbox doesn’t support a template, then no records will be copied over as part of its creation. In this instance, you or your users will need to create test data. This can be done by manually creating Salesforce records, importing data, or using APEX.
How to Create a Salesforce Sandbox
Now that you know the different sandbox options available, let’s go through the steps to creating a sandbox.
If you are planning to use a template, be sure to set this up before you try to create the sandbox!
From Salesforce Setup search for Sandboxes, then select New Sandbox.
Define a name and description, select the type, set the sandbox template (where applicable), and optionally choose to run some scripts that will run after creation (for example, to create some test data). Once you are done select Create to start the process.
The length of time it takes to ‘spin’ up a new sandbox can be anywhere from a few minutes for Developer Sandboxes, to 24 hours (or more) for a Full Copy version. This will depend on the amount of data and metadata that is being copied over.
When a sandbox is created every user will have .invalid added onto their email (apart from you) and .sandbox name added onto their username. For example, mine would be tom@email.com.dev for a sandbox called “Dev”. To log in to a sandbox, use test.salesforce.com instead of login.salesforce.com. Passwords will be copied from production, but be sure to make the email addresses valid in case a user needs a password reset!
How to Refresh a Salesforce Sandbox
Let’s say you created a sandbox a while ago and it’s now out of date when compared to production. To ensure your sandbox provides an up-to-date snapshot of the live system, you’ll need to refresh the sandbox.
Refreshing will wipe (delete) all data and metadata from the sandbox as it copies the latest configuration from production. Only refresh if you are happy for any changes in your sandbox to be overwritten!
From Salesforce Setup, use the Quick Find to search for Sandboxes. Next to the name of the sandbox, click Refresh to get started, and then follow the wizard.
You’ll only be able to refresh a sandbox if it’s available for a refresh. Once a sandbox has been refreshed, if you didn’t select it to “auto activate”, you’ll get an email when it’s ready.
How to Deploy From Sandbox to Production
There are various different ways to move changes from your sandbox into production – these include:
Summary
You may be thinking: Why do I need a Sandbox anyway? The simple answer is that using a sandbox pipeline for development and testing can ensure changes are thoroughly tested and do not interrupt your live environment. Salesforce Developers and Architects may also be interested in learning about scratch orgs.
A sandbox pipeline might resemble something like this:
Often, when a customer doesn’t have a Full Copy sandbox, they use a Partial Copy instead. If a customer has both a Partial and Full Copy Sandbox, the Partial Copy would appear before the Full Copy in the Sandbox pipeline.
One final thought – if you haven’t used a particular sandbox for a while, Salesforce will delete it after 180 days, so be sure to log in if you want to keep it active!
Resources
- Change Set Development Model
- Sandbox Licenses and Storage Limits per edition
- Create a Sandbox
- Refresh a Sandbox
- Activate a Sandbox
- Create or Edit Sandbox Templates
- Deploy Using Change Sets
- How to Create a Sandbox Template
Comments: