Multi org strategy

From PranavNagrecha/AwesomeSalesforceSkills · View interactive version

Multi org strategy is an AI agent skill from the GitHub repository PranavNagrecha/AwesomeSalesforceSkills. Use when deciding whether to use multiple Salesforce production orgs, designing a hub-and-spoke integration topology, reviewing an existing multi-org architecture for risk, or troubleshooting cross-org integration failures. Trigger phrases: 'should we have separate Salesforce orgs', 'how do we share

How to use this skill

Skill file

Use this skill when evaluating whether to use multiple Salesforce production orgs, designing how those orgs will exchange data, reviewing an existing multi-org architecture for hidden risks, or troubleshooting cross-org integration failures. This skill addresses the structural decision layer — it does not replace role-specific skills for building individual integrations, configuring Named Credentials, or setting up SSO providers.


Before Starting


Questions to Ask Before Configuring

Each question traces to a gotcha in references/gotchas.md.

| Question | Why it matters | What a good answer adds | What proper configuration adds over just doing it |

|---|---|---|---|

| "What written requirement can one org not satisfy?" | Without one, every extra org buys duplicated users, licences, releases, and API budgets for nothing | A named regulation, contract clause, or divestiture date in the decision record | The org count is defended by a requirement, and the record says when to revisit it |

| "Which data must cross org boundaries, in which direction, and how many records per day?" | The receiving org's inbound API allocation comes from its own licences, and small spokes run out first (Gotcha 3) | A per-pair volume table and the receiving org's allocation from the Limits Quick Reference formula | Bulk API 2.0 or batched calls chosen up front instead of after a 24-hour lockout |

| "Must the other org's data drive automation, formulas, or roll-ups, or only be displayed?" | External objects take no triggers, formulas, roll-ups, or master-detail (Gotchas 2, 5) | A split between display-only reads (cross-org adapter) and replicated data (sync jobs) | Automation runs in the owning org, so nothing waits on a trigger that cannot exist |

| "Which identity provider owns users, and how is a leaver deactivated in every org?" | SSO stops new sessions but deactivates nothing; JIT acts only at login (Gotchas 4, 9) | A provisioning and deprovisioning design per org, with one SAML registration per org | Leavers lose access everywhere on the same day, and MFA is enforced at the IdP for every org |

| "Is Salesforce to Salesforce enabled anywhere, and which connections are accepted today?" | S2S connections have their own lifecycle and no supported growth path (Gotcha 1) | The PartnerNetworkConnection inventory with a replacement per connection | A dated retirement plan instead of a fragile connection nobody owns |

| "Which integration user in each target org serves each cross-org connection?" | A named-principal connection fails for everyone when that one user changes (Gotcha 8) | A dedicated user per data source, excluded from automated leaver jobs | Cross-org reads survive offboarding sweeps and credential rotations |

What proper configuration adds over "just connecting the orgs": each org has a stated reason to exist, each data flow has an owner and an API budget, and identity lifecycle covers every org rather than the first one.


Recommended Workflow

  1. Record the driver. Write the requirement that a single org cannot satisfy and test it against "When Multiple Production Orgs Are Justified" below. No written requirement means a single-org recommendation.
  2. Inventory what exists. For each org, capture licences by type, the 24-hour inbound API allocation, active S2S connections (SELECT ConnectionName, ConnectionStatus, ConnectionType FROM PartnerNetworkConnection), named credentials, external data sources, and integration users.
  3. Choose the topology (single org, hub-and-spoke, or peer-to-peer) with Mode 1 Step 2, and name the system of record for every shared object.
  4. Pick a mechanism per org pair from the Integration Pattern Decision Matrix, and check its daily volume against the receiving org's allocation (Gotcha 3).
  5. Design identity per org: one SAML registration each, Federation ID mapping, and an explicit deprovisioning path (Gotchas 4, 9).
  6. Write the decision record and release manifest (worked example in references/examples.md, Example 4), then run python3 scripts/check_multi_org.py --project-dir <force-app> to catch S2S use, hard-coded org Ids, and literal callout endpoints.
  7. Set the review trigger: contract renewal, a Hyperforce region becoming available, or the end of an M&A transition, with an owner for consolidation.

Core Concepts

Single Org Is the Default Recommendation

Salesforce architects strongly recommend single-org architecture unless a specific, documented requirement justifies multiple orgs. A single org eliminates:

When requirements can be satisfied inside a single org using standard multi-tenancy features (Sharing Rules, Record Types, Permission Sets, Business Units in Marketing Cloud), a single org is always the lower-risk, lower-cost path.

When Multiple Production Orgs Are Justified

Multiple production orgs are justified only when a single org structurally cannot satisfy the requirement:

| Scenario | Justification | Notes |

|---|---|---|

| Regulatory data residency | EU GDPR or similar law requires that personal data remain in a specific geographic region and Salesforce's Hyperforce region selection in a single org does not satisfy the regulator | Verify with Salesforce Account team whether Hyperforce resolves the requirement before committing to a second org |

| Distinct business units with zero data overlap | Two fully independent companies or brands that happen to share a Salesforce contract, but share no customers, users, or processes | Rare in practice; most BU separation is handled with Sharing Rules and Permission Sets |

| M&A integration (transitional state) | An acquired company runs a separate Salesforce org and migration into the acquiring org has not yet been completed | Treat this as a temporary state with a migration plan; do not design permanent multi-org architectures around M&A without a clear end state |

| Independent ISV product with tenant isolation | A product sold to external customers requires strict data isolation per customer (not just Sharing Rules) | ISV-specific pattern; consult Salesforce ISV architect guidance |

What Multiple Orgs Do NOT Solve


Mode 1: Design a Multi-Org Strategy from Scratch

Use this mode when a new org topology is being designed before any build begins.

Step 1 — Confirm the multi-org justification

Ask the client or stakeholder to provide a written requirement that a single org cannot satisfy. If they cannot articulate one, default to single-org architecture. Document the justification in the architecture decision record.

Step 2 — Select an org topology

Option A: Single Hub Org

All business processes live in one production org. Cross-system data exchange is handled via Salesforce APIs to external systems (non-Salesforce). This is the preferred end state.

Option B: Hub-and-Spoke

One "hub" org aggregates and coordinates data from multiple "spoke" orgs. The hub holds canonical records or reporting aggregates. Spoke orgs hold domain-specific data.

Option C: Peer-to-Peer

Two or more orgs exchange data directly with no central coordinator. This topology has the highest complexity and is the hardest to govern. Avoid it unless the orgs have truly independent data domains with only occasional cross-org lookups.

Step 3 — Design cross-org data exchange

For each org pair that must exchange data:

  1. Choose the integration mechanism:
  1. Authenticate with Named Credentials:
  1. Define data ownership:

Step 4 — Design identity and SSO

Step 5 — Account for licensing


Mode 2: Review an Existing Multi-Org Architecture

Use this mode when reviewing an inherited or in-flight multi-org design for risks and improvement opportunities. Run the inventory in Recommended Workflow step 2, then score the estate against the checklist below.

Review Checklist


Mode 3: Troubleshoot Multi-Org Integration Problems

Use this mode when cross-org integrations are failing, hitting limits, or behaving inconsistently.

Diagnostic Table

| Symptom | Likely cause | Where to look |

|---|---|---|

| Cross-org callout hitting API limit | Both orgs consuming callout limits simultaneously; or S2S hitting SOAP API limits on both ends | Debug logs on calling org (check CALLOUT_REQUEST/CALLOUT_RESPONSE); API Usage in target org Setup |

| Named Credential OAuth token expired or invalid | JWT certificate rotation or Connected App scope change | Named Credential config in calling org; Connected App session policies in target org |

| External Object query returning no rows | Cross-org (SfdcOrg) data source endpoint or apiVersion changed; integration user deactivated or permission revoked in the target org | Salesforce Connect external data source setup; Check integration user profile and permission set in target org |

| Hard-coded org ID causing failures in new environment | Org ID embedded in Apex, Custom Settings, or Flow | Search Apex source for 18-char Salesforce org ID pattern; check Custom Settings and Flow variable defaults |

| Salesforce-to-Salesforce connection broken after org refresh | S2S connections are environment-specific; sandbox refresh resets them | Migrate off S2S; use Named Credentials + REST API instead |

| Users can SSO into one org but not the other | SP configuration mismatch in IdP; Entity ID or ACS URL wrong for second org | SAML settings in both orgs; IdP application configuration |

| Sync job creates duplicates | No deduplication key defined; bidirectional sync without conflict resolution | Upsert key selection on target org; review sync job logic for idempotency |

| Bulk API 2.0 job failing for cross-org data load | Integration user lacks bulk API permission; field-level security on target org blocking fields | Integration user profile in target org; Bulk API permission set assignment |


Integration Pattern Decision Matrix

| Scenario | Recommended Pattern |

|---|---|

| Read another org's record on-demand (low volume) | Salesforce Connect cross-org adapter: ExternalDataSource type SfdcOrg (corrected from "OData adapter"; see Gotcha 7) |

| Sync a small number of records in near-real-time | REST API callout from Apex or Flow → Named Credential + Connected App |

| Nightly full sync of hundreds of thousands of records | Bulk API 2.0 job from scheduled Apex or MuleSoft/external ETL |

| New multi-org integration replacing Salesforce-to-Salesforce | REST API + Named Credentials (JWT Bearer) — deprecate S2S immediately |

| Report across data in multiple orgs | CRM Analytics with multi-org data connectors, or replicate to a dedicated analytics org |


Salesforce-to-Salesforce (S2S) — Legacy Feature Notice

Salesforce-to-Salesforce is a native Salesforce feature that allows records to be published from one org and subscribed in another. It exists and continues to function, but Salesforce considers it a legacy integration approach.

Do not use S2S for new integrations. Reasons (UNVERIFIED (2026-10-03): the four reasons below come from Salesforce Help and field experience, which this revision could not fetch; the grounded facts are the PartnerNetworkConnection lifecycle and availability rules in references/gotchas.md Gotcha 1):

Migration path from S2S: Replace with a REST API integration authenticated via Named Credentials (JWT Bearer flow) in the calling org, with a Connected App in the target org. For high volume, use Bulk API 2.0.


Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.