Ask Krrish Contact
Home
Developer & Admin
Apex Triggers Mastery Asynchronous Apex SOQL & SOSL Governor Limits Flows & Process Builder
Advanced Topics
LWC Essentials Security & Sharing Managed Packages Deployment & CI/CD Integration Patterns
Interview Prep
Practice interview questions
Resources
Sales Cloud Class Diagram
Blog AI News
Available Now
Agentforce Pricing Calculator New Debug Log Analyzer SFX Forge New SFX Grove SFX Travel Manager
Salesforce + AI
AI Agent Development Salesforce Agentforce Development Custom RAG Solutions AI + Salesforce Integration Customer Support AI Agents AI Lead Qualification AI Knowledge Base Assistant AI Workflow Automation
Salesforce work
Issue Fix Sprint Automation Sprint LWC & integrations Overflow support for partners Agentforce & AI usage review All services →
About Ask Krrish Contact

Salesforce Integration Patterns and APIs: Complete Guide and Interview Questions

Explore essential Salesforce integration patterns and technologies. Learn how to connect Salesforce with external systems efficiently, reliably, and securely, enabling a unified business ecosystem.

Need hands-on help?

Which Salesforce integration pattern should I use?

Salesforce integration patterns are chosen by direction and timing. Use Request and Reply with a Named Credential callout when Salesforce needs an answer now, and Fire and Forget with platform events or Change Data Capture to notify other systems. Use Bulk API 2.0 for large data syncs, and the REST or Composite API when outside systems write to Salesforce.

  • Store endpoints and credentials in Named Credentials and External Credentials, never in code.
  • Bulk API 2.0 is built for large data loads; REST and Composite APIs suit smaller, real-time calls.
  • Platform events carry custom business events; Change Data Capture publishes record changes automatically.
  • Subscribe to events from outside Salesforce with the Pub/Sub API.
  • Use the JWT bearer or client credentials OAuth flow for server-to-server access.

1. Introduction to Salesforce Integration

In today's interconnected business world, Salesforce rarely operates in isolation. It often needs to exchange data and trigger processes with other systems — ERPs, marketing automation platforms, data warehouses, and custom applications. This connectivity is achieved through Salesforce Integration.

Effective integration ensures that data is consistent, processes are streamlined across systems, and a holistic view of customers and operations is maintained. Without proper integration, businesses face data silos, manual data entry, and inefficient workflows.

Why is Integration Important?

  • Data Consistency: Ensures data is accurate and up-to-date across all connected systems.
  • Process Automation: Automates end-to-end business processes that span multiple applications.
  • Enhanced Customer View: Provides a 360-degree view of the customer by consolidating information from various sources.
  • Improved Efficiency: Eliminates manual data entry and reduces human error.
  • Real-time Insights: Enables real-time data exchange for immediate decision-making.
  • Scalability: Supports growing business needs by allowing systems to communicate seamlessly.

This module covers the most common Salesforce integration patterns, the technologies available to implement them, and best practices for building robust and scalable integrations.

2. Common Integration Patterns

Integration patterns are reusable solutions to common integration challenges. Understanding these patterns helps in designing robust and efficient data exchange mechanisms between Salesforce and external systems.

a. Request and Reply (Synchronous)

  • Description: Salesforce sends a request to an external system and waits for an immediate response.
  • Use Cases: Real-time validation (credit scores, address validation), fetching current inventory levels, single record lookups, immediate data updates requiring instant feedback.
  • Salesforce Technologies: Apex Callouts (HTTP, SOAP, REST), LWC invoking Apex, External Services.
  • Considerations:
    • Governor Limits: 100 callouts per transaction, 120 seconds cumulative timeout.
    • User Experience: Long-running synchronous calls can cause page freezes. Keep response times under 5–10 seconds.
    • Error Handling: Immediate feedback on success or failure, but requires robust handling of external system downtime.

b. Fire and Forget (Asynchronous)

  • Description: Salesforce sends a message or data to an external system and does not wait for an immediate response. The external system processes asynchronously.
  • Use Cases: Sending notifications (SMS, email via external service), logging to an external system, triggering long-running external processes, sending data to a data warehouse.
  • Salesforce Technologies: Platform Events, Outbound Messages, Apex Callouts via @future, Queueable Apex, or Batch Apex.
  • Considerations:
    • Reliability: Requires mechanisms to ensure message delivery (message queues, guaranteed delivery).
    • Order of Processing: If strict order is critical, additional mechanisms may be needed.
    • No Immediate Feedback: User is not immediately aware of the outcome.

c. Batch Data Synchronization

  • Description: Large volumes of data are exchanged between Salesforce and an external system at scheduled intervals — an asynchronous, bulk-oriented pattern.
  • Use Cases: Daily/weekly sync of customer master data, product catalogs, historical sales data, initial data loads, data archiving.
  • Salesforce Technologies: Batch Apex, Data Loader, ETL tools (MuleSoft, Informatica, Talend), Heroku Connect.
  • Considerations: High volume design minimizing API calls; robust scheduling, data transformation, and error logging for failed records.

d. Remote Call-in

  • Description: An external system initiates a connection to Salesforce to retrieve or send data. Salesforce acts as the server.
  • Use Cases: External reporting tools pulling Salesforce data, e-commerce sites pushing new orders, mobile apps accessing Salesforce data.
  • Salesforce Technologies: REST API, SOAP API, Bulk API, Streaming API, @RestResource, webService keyword.
  • Considerations: Proper OAuth authentication, API request limits, IP whitelisting, HTTPS encryption.

e. Remote Call-out

  • Description: Salesforce initiates a connection to an external system to retrieve or send data. Salesforce acts as the client.
  • Use Cases: Sending order details to an ERP, fetching data from a legacy system, integrating with payment gateways or shipping carriers.
  • Salesforce Technologies: Apex Callouts, External Services, Salesforce Connect for external-object integrations.
  • Considerations: Remote Site Settings or Named Credentials required; subject to callout limits; often requires async Apex to avoid UI blocking.

f. Change Data Capture (CDC) / Event-Driven

  • Description: Salesforce publishes events for changes to records (create, update, delete, undelete). External systems subscribe to receive real-time notifications — a highly scalable and decoupled pattern.
  • Use Cases: Real-time sync with external systems, triggering external processes on Salesforce data changes, maintaining external data warehouses in sync.
  • Salesforce Technologies: Change Data Capture (CDC) events, Platform Events.
  • Considerations: Change events in the event bus follow transaction commit order; subscribers receive them in Replay ID order. Preserve that order during processing, handle duplicates, and make processing idempotent.

3. Integration Technologies: Salesforce APIs Overview

Salesforce provides a rich set of APIs as the primary programmatic interface for external applications to interact with Salesforce data and metadata.

a. REST API

A flexible, lightweight, widely adopted web service API based on RESTful principles using standard HTTP methods (GET, POST, PUT, PATCH, DELETE).

  • Key Features: Resource-oriented URIs, stateless, JSON/XML support, standard HTTP methods.
  • Common Endpoints:
    • /services/data/vXX.0/sobjects/ — Interact with standard and custom objects.
    • /services/data/vXX.0/query/?q=SOQL_QUERY — Execute SOQL queries.
    • /services/data/vXX.0/composite/ — Combine multiple API requests in a single call.
    • /services/data/vXX.0/actions/ — Invoke invocable Apex actions.
  • Use Cases: Mobile apps, single-page web applications, real-time low-to-medium volume data exchange, custom UI development.

b. SOAP API

A robust, XML-based web service API with a strongly typed interface defined by a WSDL file — describing all available operations, data types, and service endpoints.

  • Key Features: WSDL-driven client generation, strongly typed, transaction-oriented.
  • Use Cases: Enterprise integrations requiring strict data contracts, complex transactions, legacy system integrations.

c. Bulk API

An asynchronous API for loading or querying large datasets. Operations involving more than 2,000 records are candidates for Bulk API 2.0; choose an API based on the workload and its requirements.

  • Bulk API 2.0 ingest: Create a job, upload data, set the job state to UploadComplete, monitor the job, and retrieve results. Salesforce creates the batches.
  • Query jobs: Create and monitor a query job, then retrieve its results. Review individual ingest results for successful and failed records.
  • Use Cases: Data migrations, large-scale nightly syncs with ERPs, mass updates/deletions.

d. Streaming API

Enables real-time notifications of changes in Salesforce data or custom events using a publish-subscribe model.

  • PushTopic Events: Custom SOQL queries streaming changes to specific fields. Older but still supported.
  • Platform Events: Custom events for decoupled, asynchronous communication — highly scalable and publishable from Apex, Flow, or external systems.
  • Change Data Capture (CDC) Events: Events for record changes (create, update, delete, undelete) delivered in Replay ID order. They can support real-time data replication when consumers preserve order and reconcile missed changes.
  • Use Cases: Real-time dashboards, event-driven architectures, IoT device integration, external data warehouse sync.

How do you recover an event subscription?

Use Pub/Sub API flow control and durable replay checkpoints to resume processing after interruptions. Checkpoint only after the corresponding work is durable, and make consumers idempotent because events can be delivered again.

Replay is limited by event retention, so monitor subscriber lag and plan a full reconciliation when a checkpoint is no longer available. CDC gap events indicate that changes were not captured; reconcile the affected data rather than assuming the stream is complete. Use transaction identifiers and sequence information to preserve transaction boundaries and ordering when applying changes. Test restart, duplicate, gap, and reconciliation paths against the needs of the destination system.

e. Metadata API

Used to retrieve, deploy, create, update, or delete customization information (metadata) in your org — essential for programmatic configuration management.

  • Use Cases: CI/CD pipelines, automated configuration management, building deployment tools, migrating customizations between orgs.

4. OAuth Flows for Salesforce Integration

OAuth 2.0 is the industry-standard protocol for authorization. Salesforce uses OAuth to authorize external applications to access Salesforce data. Use an External Client App for new integrations; existing Connected Apps remain supported. Configure the application’s OAuth policies and scopes for its intended access.

a. Web Server Flow

  • Purpose: Ideal for confidential web applications (server-side) that can securely store a client secret.
  • Process: User redirected to Salesforce → logs in and grants access → Salesforce redirects back with an auth code → server exchanges code for access token using client ID + secret.
  • Security: High — client secret is never exposed to the browser.
  • Use Cases: Server-side web applications, backend-handled authentication.

b. User-Agent Flow (Implicit Flow)

  • Purpose: This flow returns an access token directly to the client through the browser.
  • Security: Tokens can be exposed in the URL fragment, and refresh tokens are typically not issued.
  • Guidance: Avoid implicit flow; use authorization code with PKCE for public clients such as single-page applications and mobile apps.

c. JWT Bearer Flow

  • Purpose: Server-to-server integrations with no direct user interaction (headless integrations).
  • Process: The client signs a JWT with its private key and exchanges the assertion at the Salesforce OAuth endpoint for an access token. Salesforce validates the signature using the configured certificate.
  • Security: Protect the private key, signed assertion, and access token; grant only the access required by the integration.
  • Use Cases: Automated batch processes, scheduled integrations, data synchronization, headless integrations.

d. Username-Password Flow

  • Purpose: Exchanges a Salesforce username and password for an access token.
  • Security: Exposes user credentials to the client and is blocked by default in newer orgs.

Avoid this flow. Use a supported alternative such as client credentials for a suitable server-to-server integration or authorization code for an interactive application.

How do you authorize a server-to-server integration?

Use the client credentials flow when an integration can authenticate as an application without interactive user authorization. Salesforce issues the access token in the context of the configured run-as user.

Assign a dedicated integration user to each integration so that access and activity can be managed independently. Grant only the object, field, and other permissions required for its work, and restrict the application's OAuth scopes and policies. Protect and rotate the client credentials, monitor their use, and revoke access when the integration is retired. For an integration acting on behalf of an individual user, select a flow suited to that delegation instead.

e. Device Flow

  • Purpose: For devices with limited input capabilities (smart TVs, IoT devices, CLI tools) that cannot host a web browser.
  • Use Cases: IoT, embedded devices, CLI tools.

f. Asset Token Flow

  • Purpose: Designed for authenticating IoT devices or connected assets to securely interact with Salesforce.
  • Use Cases: IoT solutions, asset management, connecting physical devices to Salesforce.

Choosing the Right Flow: Always prioritize flows that do not require storing user credentials (Web Server, JWT Bearer, Device Flow). The choice depends on client type, security requirements, and user interaction model.

5. Declarative Integration Tools

Salesforce offers powerful declarative (clicks-not-code) tools that enable administrators and low-code developers to build integrations, reducing the need for custom Apex development.

a. External Services

  • Description: Declaratively connect Salesforce to external APIs by importing an OpenAPI (Swagger) specification. Salesforce automatically generates Apex classes and Flow actions.
  • How it Works: Provide an OpenAPI JSON/YAML file → Salesforce parses it and creates invocable actions usable in Flow or Apex.
  • Use Cases: Invoking payment gateways or shipping label generation from Flow, retrieving data from external systems in Flow.
  • Benefits: Faster development, reduced code, easier maintenance, empowers admins.

b. Salesforce Connect (External Objects)

  • Description: Access data stored outside Salesforce in real-time without copying it into Salesforce. External objects map to external data via OData 2.0, OData 4.0, or Apex Custom Adapter.
  • How it Works: Salesforce queries the external system via the adapter whenever a user or process accesses the external object — data always resides in the external system.
  • Use Cases: Displaying real-time order history from SAP, accessing legacy database data, real-time inventory that doesn't need to be stored in Salesforce.
  • Considerations: Performance depends on external system response time and network latency; subject to Salesforce Connect limits.

c. Outbound Messages

  • Description: A declarative mechanism that sends a SOAP message (XML) to an external endpoint through a Workflow Rule or Flow. Workflow Rule support has ended; existing rules continue to run and can be migrated to Flow.
  • Delivery: Failed deliveries are retried for up to 24 hours. Consumers must handle duplicate messages and possible reordering.

Choosing a mechanism: Compare outbound messages and Platform Events against the delivery, data format, and integration requirements of the consumer.

d. Platform Events (Declarative Usage)

  • Publishing: Use a "Create Records" element in Flow to publish a Platform Event.
  • Subscribing: Use a "Platform Event Triggered Flow" to subscribe and execute logic when an event message is received.
  • Benefits: Decoupled, asynchronous, scalable, robust event-driven architecture with low-code options.

6. Programmatic Integration Tools (Apex)

For complex integration scenarios, custom logic, or when declarative tools are insufficient, Apex provides powerful capabilities to interact with external systems.

a. Apex Callouts (HTTP, REST, SOAP)

  • Description: Apex code can make HTTP callouts to external web services, supporting both RESTful and SOAP-based integrations.
  • Key Classes:
    • HttpRequest — Constructs the HTTP request (method, endpoint, headers, body).
    • HttpResponse — Represents the response (status code, body, headers).
    • Http — Sends the request and receives the response.
  • Key Considerations:
    • Callouts from trigger context must be async: @future(callout=true), Queueable, or Batch Apex.
    • Use Named Credentials for endpoint management. An associated External Credential defines authentication and principals; map principal access through permission sets, permission set groups, or profiles.
    • Robust try-catch blocks for network issues, timeouts, and unexpected responses.

The following example assumes an ERP batch endpoint whose contract treats every 2xx response as acceptance of the entire request. A successful acceptance does not necessarily mean processing is complete. If the API reports individual failures, inspect and handle each result. The caller must handle exceptions with a sanitized failure outcome and alert or retry as appropriate.

Apex — REST Callout (POST)
public with sharing class MyRestCallout {
    public class IntegrationException extends Exception {}

    public static void sendOpportunitiesToERP(Set<Id> opportunityIds) {
        if (opportunityIds == null || opportunityIds.isEmpty()) {
            return;
        }

        List<Opportunity> opportunities = [
            SELECT Id, Name, Amount, CloseDate
            FROM Opportunity
            WHERE Id IN :opportunityIds
            WITH USER_MODE
        ];
        if (opportunities.size() != opportunityIds.size()) {
            throw new IntegrationException('Some requested opportunities are unavailable.');
        }
        List<Map<String, Object>> requestBody = new List<Map<String, Object>>();
        for (Opportunity opp : opportunities) {
            requestBody.add(new Map<String, Object>{
                'salesforceId' => opp.Id,
                'opportunityName' => opp.Name,
                'amount' => opp.Amount,
                'closeDate' => opp.CloseDate
            });
        }
        HttpRequest req = new HttpRequest();
        req.setMethod('POST');
        req.setEndpoint('callout:MyERPIntegration/api/opportunities/batch');
        req.setHeader('Content-Type', 'application/json');
        req.setBody(JSON.serialize(requestBody));

        HttpResponse res = new Http().send(req);
        Integer status = res.getStatusCode();
        if (status < 200 || status >= 300) {
            throw new IntegrationException('ERP request failed with HTTP status ' + status);
        }
    }
}

How do you secure and test an Apex integration?

Declare the intended sharing behavior and enforce object and field permissions for data accessed by the integration. Use explicit user-mode queries or DML where appropriate; database operations default to user mode in Apex API version 67.0 and later.

Use HttpCalloutMock to test successful responses, error statuses, and callout failures without calling the external service. Test with multiple records and verify that failures reach the caller. Arrange transactions so that callouts occur before DML that leaves uncommitted work, or split the work into separate transactions. Review permissions for the executing user and test denied access as well as authorized access.

b. Inbound Apex Web Services

  • Description: Apex classes can be exposed as web services (RESTful or SOAP) that external systems can call.
  • Key Annotations:
    • @RestResource(urlMapping='/MyEndpoint/*') maps to the client path /services/apexrest/MyEndpoint/* and exposes the class as a RESTful service. Methods annotated with @HttpGet, @HttpPost, @HttpPut, @HttpDelete, @HttpPatch.
    • global static webService void mySoapMethod(...) — Exposes method as a SOAP web service.
    • @InvocableMethod — Makes an Apex method available to Flow, Process Builder, or REST API.
  • Considerations: Implement OAuth/Session ID authentication; ensure bulkification; return meaningful error responses.

c. Platform Events (Programmatic Usage)

  • Publishing from Apex: Create event instances and publish via EventBus.publish(events). Publish Immediately can publish even if the transaction fails; Publish After Commit publishes only after a successful commit. The immediate result reports whether the request was queued, not final publication. Use an asynchronous Apex publish callback for the final result of high-volume events.
  • Subscribing from Apex: Use an Apex trigger on the Platform Event object: trigger MyEventTrigger on My_Platform_Event__e (after insert) { ... }
  • Benefits: Decoupling of systems, asynchronous processing, scalability, event replayability.

7. Middleware & iPaaS Solutions

For complex enterprise integration landscapes, Middleware or Integration Platform as a Service (iPaaS) solutions sit between Salesforce and other systems, facilitating data transformation, routing, orchestration, and error handling.

What They Do

  • Connectors: Pre-built connectors to various applications including Salesforce.
  • Data Transformation: Map and transform data formats between disparate systems.
  • Orchestration: Coordinate complex multi-step processes spanning multiple applications.
  • Routing: Direct messages to the correct destination.
  • Error Handling & Monitoring: Centralized mechanisms for managing errors and tracking performance.
  • Security: Manage authentication, authorization, and encryption.

Popular iPaaS Solutions

  • MuleSoft Anypoint Platform (Salesforce product) — Leading integration platform with extensive API management, data transformation, and connectivity. The preferred choice for complex Salesforce-centric integrations.
  • Boomi Integration — Wide range of connectors and visual development tools.
  • Workato — Focuses on intelligent automation and enterprise-grade integration.
  • Jitterbit — Low-code approach with AI capabilities.

When to Use iPaaS

  • Many-to-many integrations (connecting multiple systems).
  • Complex data transformations.
  • Centralized monitoring and governance requirements.
  • High transaction volumes requiring scalable infrastructure outside Salesforce.
  • Requirements for robust error handling and retry mechanisms.

8. Integration Best Practices

Building robust and scalable Salesforce integrations requires adherence to key best practices:

  • Define Requirements Clearly: Understand data volumes, frequency, real-time vs. batch needs, security, and error handling upfront.
  • Choose the Right Pattern & Technology: Select the most appropriate pattern (synchronous, asynchronous, batch, event-driven) and technology for the specific use case.
  • Security First:
    • Use OAuth 2.0 flows that don't require storing Salesforce credentials (Web Server, JWT Bearer, Device). Avoid Username-Password flow.
    • Use Named Credentials for Apex callouts — they handle authentication securely.
    • Restrict API access through External Client App or Connected App policies and permission sets.
    • Encrypt data in transit (HTTPS) and implement IP whitelisting.
  • Handle Governor Limits:
    • Bulkify all DML and SOQL operations.
    • Use async Apex (@future, Queueable, Batch) for callouts from triggers.
    • Minimize API calls by aggregating data.
  • Error Handling & Retry Mechanisms: Robust try-catch blocks; strategies for failures (logging, notifications, graceful degradation); exponential backoff for transient errors.
  • Idempotency: Design so that performing an operation multiple times has the same effect as once — critical for handling retries and duplicate messages.
  • Data Transformation & Mapping: Define data mapping rules clearly and perform transformations at the most appropriate layer.
  • Logging & Monitoring: Comprehensive logging (custom objects, platform events, external logging services) and monitoring to track health, performance, and errors.
  • Version Your APIs: Use versioned endpoints (e.g., /services/data/vXX.0/), monitor retirement notices, and test upgrades before a version is retired. Monitor API allocations and throttling, and handle partial failures at the record level.
  • Test Thoroughly: Unit tests, integration tests, and performance tests with realistic data volumes are critical.

9. Error Handling & Monitoring

Robust error handling and proactive monitoring are vital for integration reliability. Issues in one system can quickly cascade, causing data inconsistencies and business disruptions.

a. Error Handling Strategies

  • Graceful Degradation: Design integrations to continue functioning with reduced capabilities if an external system is temporarily unavailable.
  • Retry Mechanisms: For transient errors, implement automatic retries with exponential backoff. Use Queueable or Batch Apex for controlled retry logic; store failed requests in a custom object for a scheduled job to reprocess.
  • Dead-Letter Queues (DLQ): For messages that repeatedly fail, move them to a DLQ for manual inspection and reprocessing (typically managed by iPaaS or message queue systems).
  • Alerting: Set up alerts (email, Chatter, external monitoring tools) for critical failures, timeouts, or performance degradation.
  • Comprehensive Logging: Log correlation IDs and necessary diagnostics such as status codes and timestamps. Redact secrets and sensitive fields, and restrict access and retention.
    • Salesforce Debug Logs: Useful for Apex-level debugging.
    • Custom Log Objects: Create a custom object (e.g., Integration_Log__c) to store transaction details and errors.
    • Platform Events: Publish custom error events for external monitoring systems to subscribe to.

b. Monitoring Tools & Techniques

  • Salesforce Setup: API Usage Notifications, Apex/Batch/Scheduled Jobs monitoring, Debug Logs, Connected Apps Usage, Flow Error Emails.
  • Custom Dashboards & Reports: Build Salesforce reports and dashboards on custom log objects to visualize integration health and identify trends.
  • External APM Tools: Integrate with Splunk, DataDog, or New Relic for end-to-end transaction tracing, performance metrics, and centralized logging across your entire application ecosystem.
  • iPaaS Dashboards: Leverage built-in monitoring dashboards for a comprehensive view of all integration flows.

A proactive approach to error handling and monitoring minimizes downtime, improves data quality, and builds trust in your integrated systems.

10. Integration Governance & Documentation

Beyond technical implementation, robust integration requires proper governance and thorough documentation to ensure maintainability, scalability, and long-term success.

a. Integration Governance

  • Strategy & Architecture: Define clear integration strategy, architectural principles (API-first, event-driven), and standards (naming conventions, error codes).
  • Ownership & Responsibilities: Clearly assign ownership for each integration point and define roles (business owner, technical owner, support team).
  • Security Policy: Establish and enforce policies around data access, authentication, authorization, and encryption.
  • Performance Standards: Define acceptable performance benchmarks (response times, throughput) and ensure integrations meet them.
  • Change Management: Rigorous process for existing integrations — impact analysis, testing, and deployment procedures.
  • Center of Excellence (CoE): For large organizations, centralize expertise to share best practices and ensure consistency across projects.

b. Documentation

Comprehensive documentation is critical for understanding, maintaining, and troubleshooting integrations.

  • Integration Design Document (IDD): Purpose & business context, integration pattern, systems involved, data flow diagram, data field mapping, authentication details, error handling strategy, monitoring approach, deployment & rollback steps, assumptions & dependencies.
  • API Documentation: For custom inbound Apex web services, provide OpenAPI specs or Postman collections for external consumers. Reference official Salesforce API docs for standard APIs.
  • Code Comments: Well-commented Apex code explaining complex logic, callout details, and error handling.
  • Runbook / Playbook: For support teams — detailed steps on how to monitor, troubleshoot common issues, and restart integrations.

Effective governance and documentation transform integrations from ad-hoc solutions into well-managed, reliable assets within your enterprise architecture.

11. Conclusion & Future Trends

Salesforce integration is a vast and continuously evolving domain, critical for connecting your Salesforce org to the broader enterprise ecosystem. By understanding common patterns, leveraging Salesforce's rich set of APIs and declarative tools, and adhering to best practices, you can build robust, scalable, and secure solutions.

Key Takeaways

  • Pattern-Driven Design: Choose the right integration pattern (Request-Reply, Fire & Forget, Batch, Remote Call-in/out, Event-Driven) based on business needs.
  • API Mastery: Understand when to use REST, SOAP, Bulk, Streaming, or Metadata APIs.
  • OAuth Security: Prioritize secure OAuth flows (Web Server, JWT Bearer) and use Named Credentials.
  • Declarative First: Leverage External Services, Salesforce Connect, and Platform Events with Flow for low-code integrations.
  • Apex for Complexity: Use Apex Callouts for custom complex logic, always bulkifying and handling limits.
  • iPaaS for Enterprise: Consider MuleSoft for complex, many-to-many enterprise integration landscapes.
  • Robustness & Scalability: Implement error handling, retry mechanisms, logging, and monitoring. Design for idempotency.
  • Governance & Documentation: Treat integrations as critical assets requiring clear ownership, policies, and thorough documentation.

Future Trends

  • Event-Driven Architectures: Increased adoption of Platform Events and CDC for real-time, decoupled integrations.
  • Low-Code/No-Code Integration: Salesforce will continue to enhance declarative tools (Flow + External Services) to empower more users.
  • API-First Approach: Greater emphasis on designing reusable APIs for internal and external consumption.
  • AI & Automation: Integration of AI to automate data mapping, error resolution, and intelligent routing.
  • Unified Data Fabric: Move towards a holistic view of data across disparate systems, facilitated by iPaaS and data virtualization.

By staying current with these trends and continually refining your integration skills, you'll be well-equipped to build the connected and intelligent Salesforce ecosystems of the future.

Frequently asked questions

What is the difference between REST and SOAP API in Salesforce?

REST API uses JSON over simple HTTP methods and suits web, mobile and most modern integrations. SOAP API uses XML with a strict WSDL contract, which some enterprise and legacy systems require. Both work on the same data and limits.

When should you use Bulk API 2.0?

Use it to load, update or extract large numbers of records, generally thousands or more, because it processes them asynchronously in batches and uses fewer API calls than record-by-record requests.

What are Named Credentials?

A Named Credential stores an endpoint URL, and with an External Credential the authentication details, in Setup. Apex refers to it as callout:Name, so secrets stay out of code and you don't need a separate Remote Site Setting.

What is the difference between platform events and Change Data Capture?

Platform events are custom messages you define and publish yourself, for example 'Order Shipped'. Change Data Capture automatically publishes an event whenever a record of a selected object is created, updated, deleted or undeleted.

Should I use a connected app or an external client app?

For new integrations, Salesforce recommends external client apps, which separate settings from policies and package cleanly. Existing connected apps keep working, so migrate them when you next change the integration.

Which OAuth flow should a server-to-server integration use?

Use the OAuth 2.0 JWT bearer flow or the client credentials flow, set up through a connected app or external client app. Both avoid sharing a user's password with the other system.

What is the Pub/Sub API?

The Pub/Sub API is a gRPC-based API for publishing and subscribing to platform events and Change Data Capture events from outside Salesforce, with efficient binary encoding and flow control.

Sources: Integration Patterns and Practices · Named Credentials

Get Expert Help

SFX Support — Salesforce + AI solutions. Independent: not affiliated with, endorsed by, or a partner of Salesforce, Inc. Salesforce and Agentforce are trademarks of Salesforce, Inc.