Sub topic 7
Choosing preview and non-preview sandboxes
This chapter assumes you know how to find Setup, you understand the difference between a sandbox and production, and you have refreshed a sandbox at least once. It covers how to decide which sandboxes should get a release early and which should stay on the current release. It also covers the mistakes that make preview testing less useful than it looks.
What a preview window does
Salesforce upgrades sandboxes before production. For several weeks, sandboxes on a preview instance run the upcoming release while production still runs the current one. This is your chance to find breakage before your users do.
Which instance a sandbox lives on during this window decides which release it runs:
- A preview sandbox is on a preview instance. It runs the new release early.
- A non-preview sandbox is on a non-preview instance. It stays on the current release until the general sandbox upgrade, which comes later.
Salesforce publishes the dates for each instance on Trust. Always read the dates for your own instances there, because they differ between instances and between releases.
How a sandbox ends up on a preview instance
Who decides depends on how the sandbox is created.
- Existing sandboxes stay where they are. Their instance is fixed, so you cannot move one between preview and non-preview directly.
- New or refreshed sandboxes let you choose. When you create or refresh a sandbox during the window before the upgrade, Setup asks you to pick a preview or non-preview option.
- Copying or refreshing after the cutoff date usually places the sandbox on the instance that matches the rule for that date. Check the Sandbox Preview instructions in the release notes for the exact cutoff.
The practical consequence is that your choice is made at refresh time, not at preview time. If you want a preview sandbox in three weeks, plan the refresh now.
Two details to verify each release, because the rules can change:
- Whether the preview option appears depends on the sandbox type and your instance, so you may not see a choice in every case.
- Refresh has its own interval limits per sandbox type (for example, Developer sandboxes refresh more often than Full sandboxes). A refresh that you spend on preview setup may block another refresh for days.
Deciding which sandboxes go to preview
There is no single right answer. Use these criteria.
| Sandbox role | Typical choice | Reason |
|---|---|---|
| Release-testing sandbox (Full or Partial) | Preview | It has the data volume and integrations that make regression tests meaningful. |
| Developer sandbox used for current feature work | Non-preview | Developers keep working against the release that production runs. |
| Hotfix or production-support sandbox | Non-preview | It must always match production so a fix behaves the same after deployment. |
| Integration or UAT sandbox | Depends | Preview if you test the release there. Non-preview if it supports ongoing project UAT. |
| Training sandbox | Non-preview | Trainers should not teach users features they do not have yet. |
The main idea behind the table is to separate testing the future from working in the present. A sandbox that does both gives you unreliable results for each.
The deployment direction problem
Metadata moves from sandbox to production. Production is on the old release until its own upgrade, so deploying from a preview sandbox into production can fail if the metadata uses features of the new release.
This gives a firm rule: do not make production-bound changes in a preview sandbox. Treat it as a read-and-test environment. Build in a non-preview sandbox, and deploy from there.
Problems you can run into when you break this rule:
- A deployment is rejected because the source uses a metadata type, field or attribute that production does not recognize yet.
- A change works in the preview sandbox because of a behavior difference in the new release, then behaves differently in production.
- A developer builds a feature on preview behavior and cannot release it until after the production upgrade.
If you must move something from preview toward production, validate with a check-only deployment to a non-preview sandbox first.
Choosing a split for your org
For most teams, a small number of preview sandboxes is enough. Start from your existing sandbox strategy and ask three questions.
- Where do regression tests run today? That sandbox (or its replacement) is the main preview candidate.
- Which sandboxes receive production-bound deployments? These stay non-preview.
- Who will be affected by a refresh? Refreshing a shared sandbox wipes unreleased work, so warn the team and back up metadata first.
A common pattern for a mid-sized org:
- One Full or Partial sandbox on preview for regression testing with realistic data.
- One Developer sandbox on preview for developers to debug failures found in that test run.
- All other sandboxes on non-preview.
Checking which release a sandbox runs
Never assume. Confirm the version before you start testing, otherwise you may test the old release and think it passed.
You can check in the org in several ways: the release number appears in the footer of the Salesforce Help and in the Setup area for your org, and the Trust site lists your instance and its status. You can also query the organization's instance from the CLI:
sf data query \
--target-org my-preview-sandbox \
--query "SELECT Name, InstanceName, IsSandbox FROM Organization"InstanceName tells you which instance the sandbox is on. Look up that instance on Trust to see which release it runs on the current date.
Edge cases and common mistakes
- Refreshing right before the preview window. A refresh restarts the sandbox from production metadata. If you refresh the day before the window, the sandbox is on the instance chosen at that refresh, and you may lose changes that were in progress.
- Assuming the sandbox will upgrade automatically on the date you expect. Non-preview sandboxes upgrade on their own schedule. Do not plan testing around a date you did not confirm on Trust.
- Testing with an empty sandbox. A Developer sandbox has limited data. Flows that run on large record sets and reports with heavy filters may behave differently on a Full sandbox.
- Forgetting integrations. A preview sandbox that points at the production endpoints of external systems can send real traffic. Switch named credentials and endpoints to test versions after each refresh.
- Leaving a preview sandbox too long. After the production upgrade, preview and production are on the same release again, and the sandbox is just a sandbox. Reassess whether it is still needed in its role.
- Mixing up scratch orgs and sandboxes. Scratch orgs are covered in the next chapter. They are separate from sandbox preview and use their own
releaseoption.
A worked decision
Suppose an org has four sandboxes: dev1, dev2, uat (Partial) and fullcopy (Full).
fullcopyholds a recent copy of production data and the integration test endpoints. The team runs regression tests here. It goes preview.dev1holds the current sprint and deploys touat. It stays non-preview.dev2is where developers fix any regression found infullcopy. It goes preview so a fix can be reproduced on the new release, but the final fix is built indev1and deployed from there.uatsupports user acceptance of a feature going live next week. It stays non-preview.
Once fullcopy is on the preview release, the team runs the Apex tests from the CLI to get a baseline:
sf apex run test \
--target-org my-preview-sandbox \
--test-level RunLocalTests \
--result-format human \
--wait 20This runs all local Apex tests and waits up to 20 minutes for the results. Record the failing tests so that later chapters on regression testing can compare against this baseline.
Summary of the decision rules
- Put sandboxes used for release testing on preview. Keep sandboxes used for current delivery on non-preview.
- Make the choice at refresh time, and plan the refresh around the preview window and the refresh limits.
- Do not author production-bound changes in preview sandboxes.
- Confirm the instance and release on Trust before every test run.
Exercise
Your team has a Full sandbox used for regression testing and a Developer sandbox used to build a feature that deploys to production next week. The preview window opens in three weeks. Which sandbox should be on preview, what must you do to get it there, and why should the other stay on non-preview?
Show answer
The Full sandbox should be on preview, because it has realistic data and integrations for regression testing. You cannot move an existing sandbox between instances, so you must refresh it (choosing the preview option when the refresh is offered) before the window, and plan around the refresh interval limit and backing up any work first. The Developer sandbox should stay non-preview, because its changes go to production next week and production is still on the current release. Building on the new release risks a deployment that fails validation or behaves differently in production.
Exercise
A colleague says, "I tested the release in our sandbox and everything passed." What two checks would you ask for before trusting that result?
Show answer
First, confirm the sandbox was actually on a preview instance running the new release on the test date, by looking up its instance name on Trust. Second, confirm the sandbox had realistic data and test endpoints, so the tests exercised real record volumes and integrations. Without both, a pass may only show that the old release works.