Sub topic 2
The Release Timeline: Preview, Sandboxes, Production
This chapter assumes you know how to administer a Salesforce org and understand the difference between sandbox and production orgs. It also assumes you have a general idea that Salesforce ships Spring, Summer and Winter releases. Here you will learn the order in which orgs receive each release, and what that order means for your testing plan.
Why the order matters
Salesforce does not upgrade every org at once. It upgrades orgs in waves over several weeks. Sandboxes get the release first, and production orgs follow. This gives you a window to test your customizations against the new release before your users see it.
If you miss that window, you find regressions in production. A regression is a feature that worked before the upgrade and breaks after it.
The three stages
Every release moves through the same stages.
- Preview window opens. Sandboxes that are eligible for preview are upgraded about four to six weeks before production. Pre-release orgs and preview scratch orgs are also available at this time.
- Sandbox upgrade. Sandboxes on the preview instance run the new release. Sandboxes on non-preview instances stay on the current release until later.
- Production upgrade. Production orgs are upgraded over several weekends, in groups of instances. Non-preview sandboxes are upgraded around the same time as production.
The exact dates change each release. Always take them from the published release schedule and not from memory.
Preview and non-preview sandboxes
Each sandbox sits on an instance. Salesforce decides ahead of the release whether that instance is a preview instance or a non-preview instance.
| Type | When it gets the new release | Best use |
|---|---|---|
| Preview sandbox | Several weeks before production | Regression testing and checking Release Updates |
| Non-preview sandbox | At about the same time as production | Ongoing development on the current release |
A sandbox refreshed during the preview window may land on either type, depending on the instance it is created on. The sandbox preview chapter covers how to choose between them. For now, remember that you need at least one sandbox that runs the new release early.
Preview scratch orgs
Scratch orgs let you test on the new release without touching a sandbox. The release option in the scratch org definition file selects the version.
{
"orgName": "Release Preview Org",
"edition": "Developer",
"release": "Preview"
}Setting release to Preview creates the scratch org on the upcoming release during the preview window. Setting it to Previous creates one on the prior release. Omitting it gives you the release currently in production.
Create the org with the Salesforce CLI:
sf org create scratch \
--definition-file config/project-scratch-def.json \
--alias preview-org \
--duration-days 7 \
--set-defaultThe --duration-days 7 option makes the org expire after a week, which suits a short test.
Running a baseline in a preview sandbox
Once a preview sandbox has the new release, run your Apex tests. This gives you a baseline before the production upgrade.
sf apex run test \
--target-org my-preview-sandbox \
--test-level RunLocalTests \
--result-format human \
--wait 20RunLocalTests runs every test in your org except those from managed packages. --wait 20 makes the command wait up to 20 minutes for results.
Common errors
- Assuming every sandbox is on preview. Check the instance of each sandbox before you rely on it. A non-preview sandbox will not show new behavior until later.
- Refreshing a sandbox mid-window without checking. A refresh can move the sandbox to a different instance type. Confirm the version afterward.
- Testing only Apex. Flows, page layouts and integrations can also change behavior, so cover them in your regression plan.
- Using fixed dates from an old release. Dates shift each cycle.
Exercise
Your team has one full sandbox on a non-preview instance and one developer sandbox on a preview instance. Where should you run regression tests for the upcoming release during the preview window, and why?
Show answer
Run them in the developer sandbox on the preview instance, because it already runs the new release. The non-preview sandbox stays on the current release until near the production upgrade, so tests there would not show how the new release behaves. If you need production-like data, consider refreshing a sandbox to a preview instance, and confirm the release version afterward.