A new Developer sandbox has your configuration and your users, and no records at all. That's fine for building a field, but not for testing a flow, training a team or rehearsing a migration. This guide covers what each sandbox type starts with, four ways to fill one with data, how to keep personal data out of it, and why the test data your Apex tests create doesn't help.
What each sandbox type starts with
| Sandbox | Records copied | Data storage | Refresh interval |
|---|---|---|---|
| Developer | None (metadata only) | 200 MB | 1 day |
| Developer Pro | None (metadata only) | 1 GB | 1 day |
| Partial Copy | A sample chosen by a sandbox template | 5 GB | 5 days |
| Full | Everything | Same as production | 29 days |
The figures are from Salesforce's sandbox licenses and storage limits. Two details catch people out:
- Users are always copied. User records come across in every sandbox type, even when no other records do.
- Partial Copy samples at random. It copies up to 10,000 records per object, and relationships are only kept for master-detail and required lookup fields. Ordinary lookups can point at records that didn't make the sample, and contacts or opportunities created without an account are skipped.
Four ways to fill a sandbox
| Approach | How realistic | Personal data | Repeatable |
|---|---|---|---|
| Copy production Partial Copy or Full sandbox | Real data | All of it, unless masked | Only by refreshing (every 5 or 29 days) |
| Copy and mask Data Mask & Seed | Real structure, masked values | Replaced | Masking runs on each new copy |
| Load prepared files Salesforce CLI, Data Loader | As good as your files | None, if you write the files | Yes: the same data every time |
| Generate Snowfakery, schema-aware generators | Plausible values that fit the schema | None | Yes, at any volume |
1. Copy production
A Full sandbox is the only complete copy, and the only type Salesforce supports for performance and load testing. Partial Copy is cheaper and refreshes more often, but its sample is random within the objects you choose in the template. Both bring every customer's personal data with them, which is the main argument for the next option.
2. Copy and mask
Data Mask & Seed replaces personal data in a sandbox with realistic synthetic values. It has been available to all customers since the Summer '26 release as a core app with nothing to install, and it handles up to 350 million records per masking job. It replaces the older Data Mask managed package, whose support ended on July 9, 2026. Salesforce lists generating synthetic data into an empty sandbox as a feature still to come.
3. Load prepared files
For development orgs, a small, known dataset kept in source control is often the best option: every developer and every scratch org gets the same records. The Salesforce CLI has two families of commands:
sf data import treeloads JSON files that describe records and their relationships. Salesforce positions it for small sets of data, such as fewer than 3,000 records. A plan file links several files together and the CLI batches them into the API's 200-record requests. The matchingsf data export treetakes a query that returns at most 2,000 records.sf data import bulkandsf data upsert bulkuse Bulk API 2.0 for larger volumes, one object per CSV file. Upserts take an external ID, which lets you re-run a load safely.
sf data export tree --query "SELECT Id, Name, (SELECT Id, LastName FROM Contacts) FROM Account LIMIT 50" --plan --output-dir data --target-org dev-sandbox
sf data import tree --plan data/Account-Contact-plan.json --target-org qa-sandbox
4. Generate it
Generators create records that fit your schema without copying anyone's data. Salesforce.org's open-source Snowfakery uses YAML recipes: each object template says how many rows to make, child records can be nested inside a parent, and the reference function links rows together. CumulusCI runs those recipes against an org:
cci task run snowfakery --recipe datasets/accounts_with_contacts.yml
One caution: the Snowfakery repository was archived on September 18, 2026 and is now read-only, though CumulusCI is still maintained. Schema-aware generators, including AI-based ones, take a different approach: they read each object's fields, picklist values and required fields from the org and generate records to match, so the data keeps up as the schema changes.
Keep personal data in production
Salesforce's Well-Architected guidance is direct: build development and test cycles on "synthetic data with realistic characteristics", so regulated data stays inside production. It lists Full sandboxes holding production personal data "without access controls or data masking" as an anti-pattern. In practice:
- Mask any sandbox that receives a copy of production, before you widen access to it.
- Use loaded or generated data in Developer and Developer Pro sandboxes and in scratch orgs.
- Copy only the objects a test actually needs.
Why Apex test data doesn't fill a sandbox
Apex tests create their own data, but it never reaches the org. Salesforce's documentation is explicit that "Apex test data is transient and isn't committed to the database". Records created in an @TestSetup method are rolled back when the test class finishes, and even tests annotated with SeeAllData=true roll back what they create. As the Salesforce DX guide puts it, Apex tests create their own data, but UI, API and user acceptance tests "do need baseline data".
Choosing an approach
- Building and unit testing: a small dataset loaded with
sf data import tree, kept with the code. - User acceptance testing: a Partial Copy or Full sandbox, masked, or a generated dataset at realistic volume.
- Performance and load testing: a Full sandbox.
- Demos and training: generated data, so nothing real appears on a shared screen.
- Rehearsing a migration: generated data at the volumes and parent-child shapes of the real migration, then a final rehearsal in a Full sandbox.
Fill an empty sandbox in minutes
The Salesforce Test Data Generator reads your org's schema and generates realistic, related records for any createable object, parents before children, validated before every insert.
Sources
- Sandbox Licenses and Storage Limits by Type · Salesforce Help
- Sandbox Types and Templates · Salesforce Help
- Sandbox Setup Considerations · Salesforce Help
- Which Records Are Copied When You Refresh a Salesforce Partial Data Sandbox · Salesforce Help
- Protect Sensitive Data with Data Mask & Seed · Salesforce Help
- Data Mask Managed Package Retirement · Salesforce Help
- Work With Small Datasets · Salesforce DX Developer Guide
- data import tree · Salesforce CLI Command Reference
- data import bulk · Salesforce CLI Command Reference
- Snowfakery documentation · Salesforce.org
- Automate Data Operations · CumulusCI documentation
- Understanding Test Data · Apex Developer Guide
- Work with Data · Salesforce DX Developer Guide
- Trust · Salesforce Well-Architected
- Operational Excellence: DevOps Patterns · Salesforce Well-Architected