Sub topic 12
Finding sandboxes and environment settings
This chapter assumes you can open Setup, use Quick Find, and read the Setup menu categories from earlier chapters. You should also have an account in a production org or a sandbox. A Developer Edition org works for most steps, but it has no Sandboxes page.
Why environments appear in Setup
Most teams run more than one Salesforce org. Production holds live data and users. Sandboxes are copies of production used for building, testing, and training. Setup is where you create sandboxes, identify which org you are in, and adjust settings that must differ between environments, such as email delivery.
The pages involved are spread across several menu categories. Knowing which page answers which question saves a lot of clicking.
Sandbox types
A sandbox is a copy of a production org's configuration, and sometimes its data. The type you choose controls what is copied and how often you can refresh it.
| Type | Copies | Typical use | Refresh interval |
|---|---|---|---|
| Developer | Configuration only | Individual development and unit testing | 1 day |
| Developer Pro | Configuration only, with more storage | Development, integration testing, data loading | 1 day |
| Partial Copy | Configuration plus a sample of data, defined by a sandbox template | User acceptance testing, training | 5 days |
| Full | Configuration and all data | Performance testing, staging | 29 days |
Limits and refresh intervals depend on your edition and contract. Check the Sandboxes page in your own org for the numbers that apply to you.
Opening the Sandboxes page
The Sandboxes page lives in the Environments category of Setup, under Sandboxes. You have two quick ways to reach it.
- Open Setup, type
Sandboxesin Quick Find, and select Sandboxes. - Append the page path to your org's domain.
/lightning/setup/DataManagementCreateTestInstance/homeThe internal name DataManagementCreateTestInstance is a historical leftover. Quick Find results show "Sandboxes", but the URL keeps the old name. If you build direct links for your team, use the URL and label the link yourself.
You can also open it from the CLI against an org you have already authorized:
sf org open --path lightning/setup/DataManagementCreateTestInstance/home --target-org my-prodWhat you see on the page
The page lists each sandbox with its name, type, status, and the org it was copied from. Each row has actions for logging in, refreshing, and deleting. Above the list you will find a button to create a new sandbox and a counter for how many sandboxes of each type your license allows.
Status matters when you plan work. A sandbox that is still copying cannot be used. A refresh replaces the sandbox with a fresh copy of production, so any unsaved work in that sandbox is lost. Deploy or back up changes first.
A sandbox template, under Sandbox Templates in the same area, lets you choose which objects supply sample data to a Partial Copy or Full sandbox. Create the template before you create the sandbox, because you pick it during creation.
Where the page is missing
You only see Sandboxes in orgs that can own them. Production orgs on an eligible edition have the page. A Developer Edition org does not. A sandbox does not either, unless it is set up to create sandbox copies of itself. If Quick Find returns nothing for "Sandboxes", you are probably in the wrong org or your user lacks permission. Creating and refreshing sandboxes normally requires administrator-level access, as covered in the chapter on Setup permissions.
Telling which org you are in
Sandbox and production look almost identical. Mistaking one for the other is the most common cause of changes made in the wrong place. Use these checks.
- The URL. Production and Developer Edition orgs use a My Domain such as
mycompany.my.salesforce.com. Sandbox domains include the wordsandbox, for examplemycompany--uat.sandbox.my.salesforce.com. The part after the double hyphen is the sandbox name. - The username. After a sandbox is created, usernames get the sandbox name appended, such as
[email protected]. - Company Information. In Setup, search Quick Find for
Company Information. The page shows the organization edition, Organization ID, and instance. - A query. The
Organizationobject records whether the org is a sandbox.
SELECT Name, IsSandbox, InstanceName, OrganizationType
FROM OrganizationRun it from the CLI so you can script it:
sf data query --query "SELECT Name, IsSandbox, InstanceName, OrganizationType FROM Organization" --target-org my-sandboxIsSandbox is true in a sandbox and false in production.
The URL check is quick, but the query is the most reliable, because custom domains and bookmarks can mislead you.
Logging in to a sandbox
From the Sandboxes page in production, the Login link opens a session in that sandbox without a separate password. Otherwise, sign in at https://test.salesforce.com with the suffixed username, or use your sandbox's My Domain URL.
For the CLI, authorize the sandbox once and give it an alias:
sf org login web --instance-url https://test.salesforce.com --alias my-sandbox
sf org list
sf org open --target-org my-sandboxsf org list shows every org you have authorized, with aliases. Use the alias with --target-org so commands never depend on a default that might point at production.
Settings that differ in a sandbox
Setup holds several environment-specific settings. Check them after each create or refresh.
Email deliverability
Search Quick Find for Deliverability. New and refreshed sandboxes default to System email only, which blocks emails from workflow, flows, and Apex to real recipients. This protects customers from test messages. Raise it to All email only when you have a reason, and only after anonymizing data.
User email addresses
When a sandbox is created or refreshed, user email addresses are modified, typically by appending .invalid. This prevents accidental delivery. If a tester needs to receive mail, edit that user's email under Users in Setup, and confirm the change.
Integration endpoints and credentials
A refresh copies production configuration, including Named Credentials, remote site settings, and outbound message endpoints. Review them under Security and Named Credentials so the sandbox does not call production systems. Scheduled jobs are a related risk. Check Scheduled Jobs in Setup after a refresh.
My Domain
Each org has its own My Domain. Search My Domain to see the domain name, its deployment state, and the login policy. Integrations that hardcode URLs often break when a sandbox gets a different domain.
Moving changes between environments
Once you have more than one org, you need a path for changes. The Deploy category in Setup holds the related pages:
- Deployment Settings lets you allow inbound changes from other orgs.
- Outbound Change Sets and Inbound Change Sets let you package and receive metadata.
- Deployment Status shows running and completed deployments, including errors.
Change sets move between connected orgs, for example from a sandbox to its production org. They do not move data. Developers using source control usually deploy with the CLI instead. The pages above are where you confirm what happened.
Scratch orgs and Dev Hub
Scratch orgs are short-lived orgs created from a definition file, usually by developers. They do not appear on the Sandboxes page. To create them you first enable Dev Hub in a production or Developer Edition org, using Quick Find for Dev Hub in Setup. Active scratch orgs are listed in the Dev Hub org's Active Scratch Orgs tab in the app, and you can open them with sf org open.
Common errors
- "Sandboxes" is missing from Setup. You are in a Developer Edition org, in a sandbox, or lack permission. Check the org first.
- Changes vanish after a refresh. A refresh replaces the sandbox with a new copy of production. Deploy work before refreshing.
- Test emails never arrive. Deliverability is set to System email only, or the user email still ends in
.invalid. - The sandbox login fails. You omitted the sandbox suffix from the username, or you used
login.salesforce.cominstead oftest.salesforce.com. - A CLI command hits production. A default target org was set to production. Pass
--target-orgexplicitly.
Exercise
You are in an org and are not sure whether it is production. Name two ways to confirm it from inside Setup or the CLI, and say which is more reliable.
Show answer
Check the URL for "sandbox" or the username for a sandbox-name suffix, and run SELECT IsSandbox FROM Organization (for example through sf data query). The query is more reliable because URLs and usernames can be customized or misread. IsSandbox is true only in sandboxes.
Exercise
A tester says workflow emails from the new UAT sandbox never reach her. List the two Setup settings you would check.
Show answer
Check Deliverability (Quick Find "Deliverability") to see whether access level is System email only, and check her user record, because sandbox refresh usually appends ".invalid" to user email addresses.