Sub topic 7
Sandboxes and Their Types
This chapter assumes you know what an org is, and that an org holds both data (records) and metadata (configuration and code). It also assumes you know the difference between a production org and a non-production org. If either is unclear, review the earlier chapters on orgs and org types first.
What a sandbox is
A sandbox is a copy of a production org that you use for development, testing, or training. It lives in its own isolated org with its own Org ID and its own login URL. Changes you make in a sandbox do not affect production. Sandboxes are created from a production org, and the production org must have enough sandbox licenses for its edition.
The type of sandbox decides how much of production it copies. Metadata is always copied. Data is copied only in some types.
The four sandbox types
| Type | Copies metadata | Copies data | Storage limit | Refresh interval |
|---|---|---|---|---|
| Developer | Yes | No | 200 MB data, 200 MB files | 1 day |
| Developer Pro | Yes | No | 1 GB data, 1 GB files | 1 day |
| Partial Copy | Yes | A sample, defined by a sandbox template | 5 GB data, plus files | 5 days |
| Full | Yes | All data, optionally with history | Same as production | 29 days |
Limits vary by edition and change over time, so check the current Salesforce documentation for your org before you plan around them.
Use each type for a different purpose:
- Developer sandboxes suit one developer building and unit testing a change.
- Developer Pro sandboxes suit the same work when you need more storage, such as larger test data sets.
- Partial Copy sandboxes suit user acceptance testing and training, where realistic but limited data is enough.
- Full sandboxes suit performance testing, load testing, and final staging, where you need production-sized data.
Refreshing a sandbox
A refresh replaces the sandbox with a fresh copy of current production. Each type has a minimum interval between refreshes, shown in the table. A refresh overwrites everything in the sandbox, including changes that were never deployed anywhere else.
Two common mistakes follow from this:
- Refreshing a sandbox that holds unfinished work. Retrieve or commit that work first.
- Assuming a sandbox stays current with production. Metadata changes made in production after the last refresh do not appear in the sandbox until the next refresh.
Sandbox lifecycle
The diagram shows a typical flow. You create a sandbox from production, work in it, deploy tested changes back, and refresh when the sandbox has drifted.
Data privacy in sandboxes
A sandbox that copies production data also copies sensitive customer information. Two features reduce that risk:
- Sandbox data masking replaces sensitive field values with scrambled ones after the copy. It is a paid add-on.
- Sandbox templates let you choose which objects a Partial Copy or Full sandbox copies, so you can leave out data you do not need.
Also be aware that email deliverability in a new sandbox defaults to system emails only. This stops test activity from sending messages to real customers. You can change the setting in Setup when you need to test email.
Sandbox names and logins
A sandbox user's username is the production username with the sandbox name appended after a period. For example, [email protected] becomes [email protected] in a sandbox named uat. This is why logging in with a production username alone fails in a sandbox.
Exercise
A team needs to run a load test with production-sized data volumes before a release. Which sandbox type fits, and what is the main cost compared with a Developer sandbox?
Show answer
A Full sandbox fits, because it copies all production data and has the same storage as production. The cost is a much longer refresh interval (29 days versus 1 day), and it usually takes longer to create and refresh.
Exercise
You refresh a Developer sandbox. What happens to a Flow you built there yesterday and never deployed?
Show answer
It is lost. A refresh replaces the sandbox with a copy of current production, so undeployed changes are overwritten unless you saved them elsewhere first.