Salesforce Multi-Environment and Org Topology
Overview
Map each environment to a purpose, fidelity level, data policy, authorization boundary, lifecycle, and promotion contract.
Prerequisites
- Business release model, Salesforce DX project, package strategy, org inventory, and environment owners
- Dev Hub, scratch-org, sandbox, staging, and production capabilities actually available to the customer
- Data seeding, masking, refresh, drift, namespace, dependency, promotion, rollback, and support requirements
Tool Discipline
Use Read, Glob, and Grep to inspect approved repository and evidence files, WebFetch to re-check current first-party Salesforce documentation, and Write or Edit only for secretless plans, fixtures, configuration, and redacted receipts.
Current Contract
Scratch orgs are disposable source-driven environments configured from project definitions; sandboxes provide different production fidelity and lifecycle characteristics. Available types, features, refreshes, data, and limits depend on the customer org.
Authentication
Give each environment separate aliases, apps or policies, principals, permissions, and secret references. Never copy production tokens or unmasked production data into development or CI.
Instructions
- Inventory every org and environment with purpose, edition, features, packages, namespace, data class, owner, lifecycle, and authority.
- Choose scratch org, developer sandbox, partial or full sandbox, or other approved environment from fidelity and data requirements.
- Define source, metadata, package, settings, seed, masking, and post-refresh automation contracts.
- Create environment-specific app, principal, permission, limit, event, endpoint, and secret-reference matrices.
- Automate deterministic creation or refresh where supported, then verify org identity before any deployment or data load.
- Promote immutable source and artifacts through validation gates; never promote mutable org state as the source of truth.
- Detect configuration and metadata drift, reconcile approved exceptions, test rollback, and retire environments and credentials on schedule.
Approval Boundaries
Do not create, refresh, clone, seed, mask, deploy, or retire an org without Dev Hub, admin, security, privacy, data, and release approval.
Output
Return the org topology, fidelity and data matrix, lifecycle, configuration contract, authorization map, promotion gates, drift report, and retirement owners.
Error Handling
| Condition | Response |
|---|---|
| Environment lacks a production feature | Move the test to an approved higher-fidelity org and document residual risk. |
| Production data appears in an unauthorized org | Stop access, invoke the data incident process, and prove deletion or containment. |
| Org alias resolves to an unexpected identity | Block all deployment and mutation until binding is corrected. |
Example
A redacted completion receipt might look like this:
project=core-crm; dev=scratch; integration=developer-sandbox; uat=partial; prod=production; drift=0; secrets=separate
Resources
Next Steps
Run the workflow first in the lowest-risk authorized org and preserve its redacted receipt. Schedule a review against the next Salesforce seasonal release and the customer change calendar.