Sub topic 15
Checking Your Own Org's Type and Edition
This chapter assumes you know what an org, an edition, and a cloud are, and that you have access to at least one org. It also assumes you can run commands in a terminal. You will check which kind of org you are in and which edition it runs, using three methods: the Setup UI, a SOQL query, and the Salesforce CLI.
Why check
Edition decides which features and limits apply. Org type decides whether you are working in production or in a disposable copy. Confirming both before you deploy, load data, or file a support case prevents mistakes such as changing production when you meant to change a sandbox.
Method 1: Setup UI
- Click the gear icon and choose Setup.
- In Quick Find, type Company Information and open it.
- Read the Organization Edition, Salesforce.com Organization ID, Instance, and My Domain fields.
The Organization Edition field shows the edition, such as Developer Edition or Enterprise Edition. The page does not label an org as production or sandbox in one obvious field. A sandbox usually shows a sandbox name in its My Domain URL and username. For a definite answer, use the query below.
Method 2: SOQL query
SOQL is the Salesforce Object Query Language. Run this in the Developer Console Query Editor or any SOQL tool:
SELECT Id, Name, OrganizationType, IsSandbox, InstanceName FROM OrganizationThe Organization object always holds exactly one record, so you get one row.
| Field | Meaning |
|---|---|
| `Id` | The 15-character Org ID, a stable identifier for the org |
| `Name` | The company name set for the org |
| `OrganizationType` | The edition, for example Developer Edition or Enterprise Edition |
| `IsSandbox` | `true` for a sandbox, `false` for production, Developer Edition, and most trial orgs |
| `InstanceName` | The server instance hosting the org, such as `NA123` |
Method 3: Salesforce CLI
The Salesforce CLI (sf) can authorize an org, list the orgs it knows about, and display details for one of them.
sf org login web --alias my-org
sf org list
sf org display --target-org my-orgsf org login webopens a browser so you can log in and authorize the CLI. The aliasmy-orgis a short name you choose.sf org listshows every org the CLI has authorized, including scratch orgs you created.sf org displayprints details such as the username, instance URL, and org ID for the aliased org.
In sf org list, scratch orgs appear in their own group, which is a quick way to tell them from other orgs.
Checking a scratch org
A scratch org is configured by a definition file, so its edition is written down before the org exists:
{
"orgName": "Tutorial Scratch Org",
"edition": "Developer"
}Create it from that file:
sf org create scratch --definition-file config/project-scratch-def.json --alias tutorial-scratch --duration-days 7The org expires after 7 days. Run sf org display --target-org tutorial-scratch to see its details, then run the SOQL query against it to confirm OrganizationType.
Common errors
- Reading
IsSandbox = falseas "production". Developer Edition and trial orgs also return false. Check the edition and the org's purpose. - Querying the wrong org. The CLI uses your default target org unless you pass
--target-org. Confirm the alias before running commands. - Expired scratch orgs. After the duration ends, the org is deleted and its alias no longer works.
Exercise
A query on an org returns IsSandbox = false and OrganizationType = Developer Edition. Is this org production? Which CLI command would show its username and instance URL?
Show answer
No. It is a Developer Edition org, which is separate from a production org even though IsSandbox is false. Use sf org display --target-org <alias> to see the username and instance URL.
Exercise
You need to check an org's edition without leaving the browser and without writing a query. Where in Setup do you look, and which field holds the answer?
Show answer
Open Setup, search for Company Information, and read the Organization Edition field.