Sub topic 2
Developer Edition, Trailhead Playgrounds, sandboxes and scratch orgs
This chapter assumes you know that a Salesforce org is one isolated instance of Salesforce with its own data, users and metadata. Basic terminal use is enough for the CLI snippets. By the end you should be able to choose the right kind of org for a task and say why the other kinds are a worse fit.
Why several org types exist
Salesforce is multitenant. Each customer gets an org, and that org holds configuration (metadata), records (data) and users. Different jobs need different orgs. You might want a place to learn, a copy of production for testing, or a throwaway environment that a script builds from source files.
All four types below are non-production orgs. None of them is meant to hold live customer data.
| Org type | How you get it | Cost | Lifespan | Typical use |
|---|---|---|---|---|
| Developer Edition | Sign-up form | Free | Long-lived while you log in | Personal learning, prototypes, a Dev Hub |
| Trailhead Playground | Trailhead, through a hands-on challenge | Free | Tied to your Trailhead account, may be reclaimed if unused | Completing Trailhead modules |
| Sandbox | Created from a production org | Included with licenses, more for larger types | Persistent, refreshed from production | Testing and staging changes |
| Scratch org | Created from a Dev Hub with the CLI | Free within limits | 1 to 30 days | Source-driven development and CI |
Developer Edition
A Developer Edition (DE) org is a free, full-featured org that you sign up for yourself. It is the subject of this tutorial. Key properties:
- It is not tied to a company. You own it and its username.
- It includes most platform features: Apex, Lightning Web Components, flows, custom objects, APIs and more. It often gets new releases before other orgs through pre-release sign-ups.
- It has small limits. Data storage is about 5 MB and file storage is about 20 MB, and it includes two full Salesforce user licenses. Chapter "Limits and keeping the org active" covers these in detail.
- It can be enabled as a Dev Hub, which lets you create scratch orgs from it.
- It lasts as long as you keep using it. Salesforce can deactivate and delete DE orgs that go unused for a long period.
Choose Developer Edition when you want a stable personal environment that you control, such as for experiments, a portfolio project or a certification exercise. It is also the usual free route to a Dev Hub.
What it is not
A DE org is not a copy of anyone's production org. It starts empty apart from sample data. You cannot refresh it from production, and it is not a supported place to hold real customer records.
Trailhead Playgrounds
A Trailhead Playground is an org that Trailhead creates for you so you can complete hands-on challenges in modules and projects. You connect it to your Trailhead account and Trailhead checks your org's configuration to award points.
Differences from a DE org that matter in practice:
- It is created from Trailhead, not from the developer sign-up form.
- It is connected to your Trailhead profile. Challenge checking works only against orgs you have connected there.
- Some playgrounds come with pre-installed sample data or settings for particular modules. Trailhead also offers special-purpose orgs and sets of Playgrounds for different content.
- It may be reclaimed if it is inactive for a long time, so do not treat it as permanent storage for your work.
- You can have several, which is useful when two modules assume conflicting settings.
You can use a Trailhead Playground for your own experiments, but it is best kept for Trailhead. Settings from one module can break another module's check, and a challenge may fail because of changes you made elsewhere.
A DE org also works for many Trailhead challenges. Some challenges expect a particular setup that only a Playground provides, so read the challenge instructions.
Sandboxes
A sandbox is a copy of a production org's configuration, and sometimes of its data, that Salesforce creates for you. You need a production org with sandbox capacity to get one. You cannot create a sandbox from a Developer Edition org.
There are four sandbox types, which differ in what they copy and how much storage they offer:
| Sandbox type | Copies | Storage (approximate) | Refresh interval |
|---|---|---|---|
| Developer | Metadata only | 200 MB data, 200 MB files | 1 day |
| Developer Pro | Metadata only | 1 GB data, 1 GB files | 1 day |
| Partial Copy | Metadata and a sample of data | 5 GB data | 5 days |
| Full | Metadata and all data | Same as production | 29 days |
Storage and refresh figures can change, so check Salesforce Help for current values.
A sandbox is the right place to test a change against the shape of real production configuration, to run UAT (user acceptance testing), and to stage a deployment. Refreshing a sandbox replaces its contents with a new copy of production. Any work in the sandbox that you have not saved to source control or deployed elsewhere is lost.
If you only have a Developer Edition org, you do not have a sandbox. DE is itself a standalone org with no production parent.
Scratch orgs
A scratch org is a disposable org that you create from a Dev Hub org, usually with the Salesforce CLI. It is defined by a JSON file, so anyone can recreate the same environment. Its lifetime is 1 to 30 days, with 7 as the default.
The flow looks like this:
- Enable Dev Hub in an org. A Developer Edition org can do this, and so can a production org.
- Authorize the CLI against the Dev Hub.
- Write a scratch org definition file.
- Create the scratch org, push source into it and work.
- Delete it, or let it expire.
A minimal definition file, saved as config/project-scratch-def.json:
{
"orgName": "My Scratch Org",
"edition": "Developer",
"features": [],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
}
}
}Creating the scratch org from a Dev Hub you authorized with the alias my-dev-org:
sf org create scratch \
--definition-file config/project-scratch-def.json \
--alias my-scratch \
--duration-days 7 \
--target-dev-hub my-dev-orgScratch orgs have their own limits. A Dev Hub in a Developer Edition org is allowed fewer active and daily scratch orgs than a Dev Hub in a paid production org. At the time of writing the Developer Edition figures are 3 active and 6 per day. Check sf org list limits against your Dev Hub for the live numbers:
sf org list limits --target-org my-dev-orgLook for the ActiveScratchOrgs and DailyScratchOrgs rows in the output.
A scratch org starts empty. It has no data and no customization other than what your definition file and your pushed source provide. It is a good fit for development driven by version control and for CI jobs. It is a poor fit for anything that must persist, since the org expires.
Where each org type sits
Scratch orgs belong to a Dev Hub. Sandboxes belong to a production org. Developer Edition and Trailhead Playgrounds stand alone.
Choosing an org
Work through these questions in order.
- Are you completing a Trailhead module? Use the Trailhead Playground the module asks for, or one you have connected to your Trailhead account.
- Do you need to test against a real company's configuration and data? Use a sandbox. This needs access to that company's production org.
- Do you need a repeatable, disposable environment built from source? Use a scratch org. You need a Dev Hub first.
- Do you want a free org of your own that lasts, for learning, prototypes, or as your Dev Hub? Use Developer Edition.
For most learners the answer is Developer Edition first, then scratch orgs from that DE once you want to practice source-driven development.
Common mistakes
- Expecting a sandbox from a DE org. The sandbox option is absent in DE, because sandboxes need a production parent.
- Putting real data in a DE org or Playground. Their storage is small and they are not for production data. Do not load customer records into them.
- Relying on a scratch org to keep your work. Commit source to version control. When the org expires, anything not retrieved is gone.
- Using one Playground for everything. Challenge checks look at the org's state. Leftover changes cause failures that are hard to trace.
- Letting a DE org go unused. An org that nobody logs in to can be deactivated. A deactivated Dev Hub also stops you creating scratch orgs.
Checking which org you are in
Once you are authorized, the CLI shows the orgs it knows and their types. Dev Hub orgs and scratch orgs are listed separately in the output.
sf org listTo check what an org really is, query its edition. A Developer Edition org reports Developer Edition, and a scratch org created from the definition above reports a Developer-type edition and has an expiration date:
sf data query --target-org my-dev-org --query "SELECT Name, OrganizationType, IsSandbox FROM Organization"IsSandbox is true for sandboxes. It is false for Developer Edition, Trailhead Playgrounds, production and scratch orgs. Scratch orgs and sandboxes can both be reached through sf org list, but IsSandbox alone cannot tell scratch orgs apart from production orgs. Use the CLI listing for that.
Exercise
A teammate wants to test a deployment against a copy of their company's production configuration and a sample of its data. They suggest using their personal Developer Edition org. Which org type fits better, and why is the Developer Edition org a poor choice?
Show answer
A Partial Copy sandbox fits, because it copies production metadata and a sample of data (a Full sandbox also works if they need all the data). The Developer Edition org is a poor choice because it is a standalone org with no connection to production. It starts empty, has very small storage limits (about 5 MB of data) and cannot be refreshed from production, so it cannot reproduce the real configuration.
Exercise
You enabled Dev Hub in your Developer Edition org and created a scratch org with --duration-days 7. Ten days later you cannot find your Apex class in the scratch org. What happened, and what should you have done?
Show answer
The scratch org expired after 7 days and was deleted, along with everything in it. You should have kept the Apex class in a source-controlled project, for example by committing it to Git or retrieving it with the CLI before expiry. Then you could push it into a new scratch org.