Sub topic 3
The four sandbox types at a glance
This chapter assumes you know the Setup menu, the difference between metadata (configuration and code) and data (records), and the idea of a production org with a development lifecycle. It gives a quick map of the four sandbox types. Later chapters cover each type, storage, and refresh rules in depth.
One production org, four kinds of copy
A sandbox is a copy of your production org in a separate environment. Salesforce offers four types:
- Developer
- Developer Pro
- Partial Copy
- Full
Every type copies all of production's metadata: objects, fields, Apex classes, flows, page layouts, and permission sets. The types differ in how much data (records) they also copy, how much storage they have, and how often you can refresh them.
- Developer and Developer Pro copy no records. You get your configuration and an empty database.
- Partial Copy copies metadata plus a sample of records. A sandbox template defines the sample.
- Full copies metadata plus all of production's records, and optionally field history and similar tracking data.
Comparison table
The figures below are the standard limits at the time of writing. Your edition and any purchased add-ons can change how many sandboxes you get. Check the Sandboxes page in Setup for your org's actual allowance.
| Type | Copies | Data storage | Refresh interval |
|---|---|---|---|
| Developer | Metadata only | 200 MB | 1 day |
| Developer Pro | Metadata only | 1 GB | 1 day |
| Partial Copy | Metadata and a sample of records | 5 GB | 5 days |
| Full | Metadata and all records | Same as production | 29 days |
Two patterns stand out:
- More data means a longer wait between refreshes. A Developer sandbox can be refreshed daily. A Full sandbox only once every 29 days.
- Storage and refresh limits are separate from the number of sandboxes you may create. You can run out of one allowance while having plenty of the other.
Developer and Developer Pro
These two types are built for individual development and unit testing. Because they carry no records, they are small and quick to create. Developer Pro is the same as Developer but with more storage (1 GB instead of 200 MB), which suits work that needs a larger set of hand-built or loaded test records.
Since they start empty, you must load your own test data. Typical sources are a data loader tool, a script, or Apex that inserts records. Teams often keep a repeatable data-seeding script in source control so each refreshed sandbox can be refilled the same way.
Partial Copy
Partial Copy includes a sample of your records, chosen through a sandbox template. The template lists which objects to copy, and Salesforce caps the sample at the 5 GB data limit and a maximum number of records per object. If you don't pick a template, Salesforce still copies a sample, but you have little control over which records you get.
Use Partial Copy when testers need realistic records, such as accounts with related contacts and cases, but not a full production volume.
Full
A Full sandbox is a replica of production, including all records. Its storage matches your production org's. Because it is large, creating or refreshing one can take hours or days, and the 29-day interval means a mistake is expensive.
Full sandboxes suit work where volume and realism matter: performance testing, load testing, user acceptance testing (UAT), and staging a release.
Detecting the environment in code
Code often needs to behave differently in a sandbox, for example to avoid calling a live payment gateway. The Organization object has an IsSandbox field. You can run this snippet as anonymous Apex in the Developer Console or with the Salesforce CLI:
Organization org = [SELECT Id, IsSandbox FROM Organization LIMIT 1];
if (org.IsSandbox) {
System.debug('Running in a sandbox');
} else {
System.debug('Running in production');
}IsSandbox tells you only that the org is a sandbox. It does not tell you which of the four types it is. To branch by type, you would store that fact yourself, for example in a custom setting or custom metadata record that your setup process populates.
Naming the type in a definition file
When you create a sandbox from the Salesforce CLI, the type is set by the licenseType property in a definition file. The values map to the four types:
| Sandbox type | licenseType value |
|---|---|
| Developer | Developer |
| Developer Pro | Developer_Pro |
| Partial Copy | Partial |
| Full | Full |
A minimal definition file for a Developer sandbox looks like this:
{
"sandboxName": "dev1",
"licenseType": "Developer"
}You will use this file later in the chapter on creating a sandbox with the CLI. For now, note that the type is a property you choose at creation time. It is not a setting you can flip afterward on a running sandbox (see the next section for the exact way to change it).
Common errors and misconceptions
- Assuming a Developer sandbox has data. It has metadata only. If testers open it and find no accounts, nothing is broken.
- Treating Partial Copy as a smaller Full sandbox. The sample is defined by a template and capped by storage. Records that are not selected are not copied, and relationships to records outside the sample may be missing.
- Expecting sandbox storage to grow with production. Developer, Developer Pro, and Partial Copy limits are fixed. Only Full tracks production's storage.
- Planning daily refreshes for every type. The 1-day interval applies only to Developer and Developer Pro. Partial Copy is 5 days and Full is 29. The interval is counted from when the sandbox was created or last refreshed.
- Confusing sandboxes with scratch orgs. Sandboxes are copies of a specific production org and persist. Scratch orgs are short-lived orgs built from a definition and source. The next chapter compares them in detail.
- Relying on a type change by editing. To move to a different type, you generally refresh the sandbox and select the new type during that refresh. The new type must be available in your allowance.
How the types map to a typical pipeline
A common layout uses the types at different stages:
- Developer or Developer Pro sandboxes for each developer's work.
- A Partial Copy sandbox for integration and QA with realistic sample data.
- A Full sandbox for UAT, performance testing, and release staging.
This is a starting point, not a rule. A small team may use only Developer Pro and Full. The chapter on choosing a sandbox type covers the decision criteria.
Exercise
A tester opens a newly created Developer Pro sandbox and sees all your custom objects and fields, but no account records. Is something wrong? What type would you pick if the tester needs a realistic sample of account and contact records, and how long must you wait between refreshes of that type?
Show answer
Nothing is wrong. Developer and Developer Pro sandboxes copy metadata only, so they start with no records. For a realistic sample of records, use a Partial Copy sandbox, defined with a sandbox template. It can be refreshed once every 5 days.
Exercise
Your code calls a live payment gateway. How can Apex detect that it is running in a sandbox, and what can it not tell you about that sandbox?
Show answer
Query the Organization object and check the IsSandbox field, as in SELECT Id, IsSandbox FROM Organization LIMIT 1. IsSandbox is true in any sandbox, but it does not say which of the four types the sandbox is.