Skip to content
Tutorials Center
My learning

Topics

Lesson 31 of 36 ยท Apps and Deployment

Salesforce Sandboxes and Release Environments

Learn the four Salesforce sandbox types, refresh rules, sandbox templates, data masking, and a development to production path, with a JavaScript stand-in for choosing a sandbox.

Changing a live CRM directly is like repairing an airplane in flight: it sometimes works, and when it does not, everyone notices. Salesforce solves this with sandboxes: copies of your production org where you build and test changes safely. A professional admin never builds a new flow, field change or integration straight in production. This lesson covers the sandbox types, how to create and refresh them, what a sandbox contains, and how to design an environment strategy.

The menus are described in words, and the demonstrations are labelled JavaScript stand-ins, not Salesforce.

What is a sandbox?

A sandbox is a separate org created from your production org. It copies metadata (objects, fields, flows, page layouts, permission sets, Apex code, and so on) and, depending on the type, some or all of your data. Changes in a sandbox never affect production. Users get a sandbox username in the form [email protected], and the login URL is test.salesforce.com (or your My Domain URL for the sandbox). Sandbox emails are deliverability-limited to system emails by default, so that testing does not email real customers.

The four sandbox types

Type Data copied Storage Refresh interval Typical use
Developer Metadata only 200 MB data and file storage 1 day A developer or admin building one change
Developer Pro Metadata only 1 GB 1 day Larger builds, integration testing, training
Partial Copy Metadata plus a sample of data defined by a sandbox template 5 GB data (and file storage proportional) 5 days User acceptance testing with realistic data
Full Metadata and all data (a complete copy), optionally with field history and chatter data Same as production 29 days Performance and load testing, staging, final rehearsal

Which types you can have, and how many, depends on your Salesforce edition and purchased licenses (for example, Enterprise Edition typically includes some Developer sandboxes and fewer Full ones; check Setup, Sandboxes to see your allotment). Storage and refresh numbers can change, so confirm the current values in Salesforce Help.

Other environments you meet: Developer Edition orgs (free personal playground, unrelated to production), scratch orgs (temporary, source-driven orgs for Salesforce DX developers), and Trailhead Playgrounds for learning.

Create and refresh

To create one: Setup, then Sandboxes, then New Sandbox. Choose a name (up to 10 characters), a description, the type, the source org (production or another sandbox, with clone), and, for Partial Copy, a sandbox template (a list of objects whose data is sampled). You can also pick Apex class to run after creation (a SandboxPostCopy class that runs after copying, for scrambling emails or setting up test data), and data masking (the Data Mask product) to anonymize sensitive fields in the new org. Creation takes minutes to hours or days, depending on size.

Refreshing a sandbox replaces its content with the current production metadata and data. A refresh deletes everything in the sandbox: unsaved work, changes not yet deployed, test data. Therefore, make sure that nothing you care about exists only in the sandbox. Salesforce enforces the refresh interval, so you cannot refresh a Full sandbox more often than once every 29 days.

After a refresh, the usual tasks are:

  1. Check email deliverability (Setup, Deliverability; default is "System email only").
  2. Replace credentials of named credentials and integration endpoints; the copy contains production endpoints. Make sure the sandbox does not talk to production systems (payments, ERP, marketing automation).
  3. Reset passwords and add test users (or change usernames to .sandbox forms), and review who has access.
  4. Re-enable or disable scheduled jobs and flows that must not run in the sandbox.
  5. Deactivate or point outbound messages and external services to test targets.
  6. Mask or remove personal data (names, emails, phone numbers) before sharing the sandbox widely, because production data in a sandbox is still personal data.

Environment strategy

A typical pipeline has several environments, each with a purpose:

flowchart LR
  D1["Developer sandbox (build, per person or feature)"] --> I["Integration sandbox (Developer Pro: combine changes)"]
  D2["Developer sandbox (another feature)"] --> I
  I --> U["UAT sandbox (Partial or Full: business testing)"]
  U --> P["Production"]
  P -.->|"refresh"| D1

Changes flow right toward production; refreshes flow back left with real metadata.

Rules that keep it safe:

  • Build in a Developer sandbox, test in an integration sandbox, have users accept it in a UAT (Partial or Full) sandbox, and then deploy to production.
  • Deploy forward only, from the lowest sandbox to the next. Never edit production metadata by hand and "fix it later" in the sandbox: environments drift apart and the next deployment overwrites or breaks something.
  • Keep sandboxes in sync: refresh them regularly so they match production.
  • Use a naming convention: DEV1, DEV2, INT, UAT, TRAIN.
  • Track what you change in a change log or version control (see Change sets and deployment).
  • Keep an emergency path for production hotfixes, with a rule to back-port the fix to the sandboxes.

Choosing a sandbox

Key questions: Do I need real data volumes or relationships? Do I only need to build metadata? Will many people test? Is this a performance test? Does it need a shared environment or a private one?

Stand-in: choose the sandbox type

This stand-in is not Salesforce. It encodes the decision rules from the table so you can try different needs.

JS Stand-in: sandbox type chooser

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Stand-in: a post-copy checklist

JS Stand-in: scramble emails after a refresh

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which sandbox type copies only metadata and has 200 MB of storage?

    Developer sandboxes copy metadata only and have 200 MB of storage.
  2. 2. What happens to a sandbox when you refresh it?

    A refresh overwrites the sandbox, so unsaved work is lost.
  3. 3. Why should integration endpoints be checked after creating a sandbox?

    Copied settings can send test transactions to real payment or ERP systems.
  4. 4. Which direction do changes normally flow?

    Deploy forward; refreshes bring production's state back to the sandboxes.

Summary

  • A sandbox is a safe copy of production for building and testing; Developer and Developer Pro copy metadata, Partial Copy adds sampled data, Full copies everything.
  • A refresh replaces a sandbox completely; after it, fix emails, endpoints, users and scheduled jobs and mask personal data.
  • Use a pipeline (Developer, then integration, then UAT, then production) and deploy forward only.

Next: Change sets and deployment