SfSkills Domains Docs GitHub

Home / integration / salesforce-to-salesforce-integration

salesforce-to-salesforce-integration

Use this skill to implement Salesforce-to-Salesforce integration patterns — covering the native S2S feature, API-based cross-org sync, Platform Event bridging, and Salesforce Connect Cross-Org adapter. Trigger keywords: Salesforce to Salesforce integration, cross-org data sharing, S2S feature, cross-org Platform Events, Salesforce Connect cross-org. NOT for multi-org strategy or architecture decisions (use architect/multi-org-strategy), single-org data sharing, or external (non-Salesforce) system integration.

Open the skill folder on GitHub


Salesforce-to-Salesforce Integration

This skill activates when a developer or integration architect needs to implement data sharing or process integration between two Salesforce orgs. It covers the full spectrum of cross-org integration patterns — from the native S2S feature (with its severe constraints) to modern API-based sync, Platform Event bridging, and Salesforce Connect cross-org access.


Before Starting

Gather this context before working on anything in this domain:


Core Concepts

Native S2S Feature (Legacy — Use With Caution)

The native S2S feature uses PartnerNetworkConnection and PartnerNetworkRecordConnection objects:

Use cases for native S2S: low-volume bidirectional sharing between partner orgs where the irreversibility is accepted and volume is very low.

API-Based Cross-Org Sync

The modern approach for cross-org record synchronization:

This pattern requires: Named Credential in source org pointing to target org, Connected App in target org, and a sync job design (trigger-based or scheduled batch).

Platform Event Bridging

For event-driven cross-org integration:

Salesforce Connect Cross-Org Adapter

For read-only real-time access to another org's data without creating a local copy:


Common Patterns

Pattern: REST API Cross-Org Sync with Named Credential

When to use: Bidirectional record sync between two Salesforce orgs where volume is moderate (below 2,000 records per job run) and latency is near-real-time.

How it works:

  1. Create a Connected App in the target org with OAuth2 credentials
  2. Create a Named Credential in the source org pointing to the target org's instance URL
  3. Source org Apex Queueable calls REST API endpoint on target org using Named Credential
  4. Target org exposes a REST Apex endpoint or uses the standard REST API for record creation
  5. Include idempotency key (external ID or unique hash) to prevent duplicate creation on retry

Pattern: Platform Event Bridge via Pub/Sub API

When to use: Async event propagation from one org to another where events trigger processes in the target org.

How it works:

  1. Source org Apex publishes Platform Events when specific records change
  2. Target org subscribes to source org's Pub/Sub API gRPC endpoint using OAuth2 authentication
  3. Target org processes events via a long-running subscription service or middleware
  4. Replay ID stored on target side to enable recovery from disconnects

Decision Guidance

ScenarioRecommended PatternReason
Low-volume bidirectional record sharing between partner orgsAPI-based sync with REST APIMore control and visibility than native S2S; reversible
Native S2S feature already enabledDocument constraints; plan migration to API-basedS2S cannot be reversed; manage within its limits
Read-only access to another org's data without copyingSalesforce Connect Cross-OrgReal-time, no replication, External Objects pattern
Async event notification to another orgPlatform Event bridge via Pub/Sub APILoose coupling; replay support
High-volume batch sync (100K+ records)Bulk API 2.0 cross-orgREST API per-transaction limits; Bulk API required at scale
Enterprise-grade multi-org orchestrationMuleSoft with Anypoint Salesforce ConnectorRetry, transformation, monitoring beyond native capabilities

Step-by-step instructions for an AI agent or practitioner working on this task:

  1. Confirm whether the native S2S feature is already enabled — query PartnerNetworkConnection in both orgs. If enabled, document the existing configuration and its constraints before designing changes.
  2. If S2S is not yet enabled, strongly recommend NOT enabling it — modern patterns provide more control. Document the recommendation.
  3. Select the appropriate cross-org pattern using the decision table above based on volume, direction, and latency requirements.
  4. For API-based sync: set up Connected App in target org and Named Credential in source org; design the sync job with idempotency keys to prevent duplicate records.
  5. For Platform Event bridging: confirm Pub/Sub API access and design the subscription service with Replay ID storage for recovery.
  6. For Salesforce Connect: provision the External Data Source in the consuming org and confirm the source org's Connected App has the required OAuth scopes.
  7. Design error handling: cross-org calls fail silently if the target org is down or rate-limited — implement retry logic and alerting.

Review Checklist

Run through these before marking work in this area complete:


Salesforce-Specific Gotchas

Non-obvious platform behaviors that cause real production problems:

  1. Native S2S cannot be deactivated once enabled — The Salesforce-to-Salesforce feature is permanently enabled once activated in an org. There is no "disable" option in the Setup UI or via API. Orgs that enabled S2S experimentally cannot remove it. Always confirm business intent before enabling.
  2. S2S consumes SOAP API call limits on both publishing and subscribing orgs — Each S2S record share counts as a SOAP API call in both the publishing org AND the subscribing org. High-volume scenarios rapidly exhaust API limits on both sides simultaneously, causing failures in both orgs.
  3. Salesforce Connect External Objects don't support all SOQL features — SOQL against Salesforce Connect External Objects has limitations: no OFFSET in queries, limited aggregate functions, and some relationship queries are not supported. Designs that assume External Objects behave identically to native Salesforce objects will encounter runtime errors.

Output Artifacts

ArtifactDescription
Cross-org integration pattern decisionSelected pattern with rationale, constraints, and implementation approach
Connected App and Named Credential setup guideConfiguration steps for API-based cross-org patterns
Error handling designRetry strategy and monitoring design for cross-org integration failures

Package files