Sub topic 3
What an org is
This chapter assumes you know what a CRM does, how SaaS delivery works, and what databases, tables, and records are. It does not assume any Salesforce experience.
The short definition
An org (short for organization) is one customer's own, isolated deployment of Salesforce. It holds that customer's data, configuration, code, users, and security settings. When people say "log in to Salesforce," they mean "log in to an org."
Salesforce runs as a multi-tenant system. Many customers share the same servers and the same underlying software. Each customer's org is a logically separate space inside that shared system. Users in one org cannot see another org's records, and changes made in one org do not affect another.
The word "org" is used loosely in practice. It can mean the whole deployment, the company's tenant, or the specific environment you are logged into. A single company usually owns several orgs, such as one for production and others for testing and development. This chapter uses "org" to mean one isolated environment with its own login, data, and configuration.
What lives inside an org
An org contains four broad kinds of things.
- Data. Records such as accounts, contacts, opportunities, and cases, plus files and attachments.
- Configuration. Custom fields, page layouts, validation rules, flows, permission sets, and other settings built with clicks rather than code.
- Code. Apex classes and triggers, Lightning web components, and other programmatic customizations.
- People and access. Users, profiles, roles, and the sharing rules that decide who can see which records.
The next chapter separates these into data and metadata. For now, note that configuration and code are both stored in the org itself, not in files on your laptop. The org is the system of record for how your Salesforce works.
Why the org is the central unit
Almost every Salesforce decision is scoped to an org.
- Licensing and edition. Your edition, license counts, and limits apply per org.
- Login and identity. A username belongs to one org. The same person can have different usernames in different orgs.
- Customization. A custom field you create exists only in the org where you created it, until you deliberately move it.
- Limits. Storage, API request allowances, and many other limits are measured per org.
If you remember one rule, remember this: nothing crosses an org boundary unless you move it on purpose.
Multiple orgs for one company
A company rarely works in a single org. Changing a live system directly is risky, so teams keep separate orgs for different purposes.
- A production org is where real users do real work with real data.
- A sandbox is a copy of a production org used for testing and development.
- A scratch org is a short-lived, configurable org created from a definition file.
- A Developer Edition org is a free org for learning and experimenting.
Later chapters cover these types in detail. The point here is that each is a full org with its own login, so a mistake in one does not damage another.
Some companies also run more than one production org. This happens after acquisitions, or when business units must be kept separate for legal or organizational reasons. It brings extra cost, because data, users, and customizations are duplicated and integrations have to bridge the gap. Most teams prefer a single production org unless there is a clear reason to split.
How you reach an org
Each org is reachable at a URL and identified by a few values.
- Org ID. A unique 15- or 18-character identifier that begins with
00D. - My Domain. A custom subdomain, such as
yourcompany.my.salesforce.com, that is the org's login and access address. - Instance. The group of servers that currently hosts the org, shown with a name like
NA123orCS45.
A later chapter covers these in detail. Two points matter now. The Org ID never changes for the life of the org. The instance can change, for example when Salesforce moves an org to different infrastructure, which is why you should rely on My Domain rather than a hard-coded instance URL.
Looking at an org with a query
You can ask an org about itself. The Organization object holds exactly one record describing the org you are connected to.
SELECT Id, Name, OrganizationType, IsSandbox, InstanceName FROM OrganizationRun this in the Developer Console Query Editor or from a tool such as the Salesforce CLI. Each field answers a different question.
| Field | What it tells you |
|---|---|
| `Id` | The Org ID |
| `Name` | The org's display name |
| `OrganizationType` | The edition, such as Developer Edition or Enterprise Edition |
| `IsSandbox` | `true` if the org is a sandbox, `false` otherwise |
| `InstanceName` | The instance currently hosting the org |
Note that IsSandbox is false for production, scratch, and Developer Edition orgs alike. It only separates sandboxes from everything else, so it cannot tell you the full org type by itself. A later chapter shows how to combine signals.
Working with orgs from the command line
The Salesforce CLI treats an org as something you authorize, name, and then target. Authorizing stores a credential locally so later commands can act on that org.
sf org login web --alias my-org
sf org list
sf org display --target-org my-orgsf org login webopens a browser, you log in, and the CLI saves the authorization under the aliasmy-org.sf org listshows every org the CLI knows about on this machine.sf org displayprints details for one org, including the username and instance URL.
The alias is only a local nickname. It is not stored in Salesforce, and two developers can use different aliases for the same org.
Orgs you can create on demand
Production orgs are bought and sandboxes are copied, but scratch orgs are created from configuration. A definition file describes what you want.
{
"orgName": "Tutorial Scratch Org",
"edition": "Developer"
}You then create the org from that file.
sf org create scratch --definition-file config/project-scratch-def.json --alias tutorial-scratch --duration-days 7This builds a new, empty org that expires after seven days. The org is disposable, and because the definition file lives in version control, you can recreate an equivalent org whenever you need one. Scratch orgs require a Dev Hub org to be enabled and authorized first. A later chapter covers this.
Common mistakes
- Treating "org" as the same thing as "edition" or "cloud." The org is the environment. The edition is a licensing level applied to it. A cloud is a product grouping. Later chapters separate these.
- Assuming a sandbox and production share data live. A sandbox is a copy made at a point in time. It does not stay in sync, and it is a separate org.
- Assuming usernames are global. A Salesforce username must be unique across all orgs, but it still belongs to exactly one org. The same person normally has a different username in each org they use.
- Hard-coding an instance URL. Instances can change. Use My Domain.
- Confusing the CLI alias with the org's name. The alias exists only on your machine.
Exercise
A developer creates a custom field in a sandbox and then asks why it does not appear in production. What is the most accurate explanation?
Show answer
The sandbox and production are separate orgs, and configuration exists only in the org where it was created. The field must be deliberately deployed from the sandbox to production. Nothing crosses an org boundary unless it is moved on purpose.
Exercise
You run the Organization query and get IsSandbox = false. Can you conclude that the org is production?
Show answer
No. IsSandbox is false for production, scratch, and Developer Edition orgs. It only rules out a sandbox. You need other information, such as the OrganizationType field or how the org was created, to tell them apart.