ServicesSalesforce consultingArchitectureImplementationOrg health checkDevelopmentIntegrations and APIsData migrationTesting and QAManaged supportSpecialist supportMarketing Cloud auditDeliverability
SolutionsMarketing Cloud EngagementMarketing Cloud NextSalesforce + BrazeAccount EngagementData Cloud (Data 360)Identity resolutionInsights and segmentsAgentforce and AIMCP integrationsSales and Service CloudReal-time personalisationIntegration solutionsEnterprise AI integrationBy industry
ArchitectureSalesforce CRMData 360Salesforce + BrazeAgentforceCustomer 360API-led integrationEvent-drivenMCP host, client and serverIdentity and consentMCP securityData governanceCI/CD and releasesOur public MCP server
ResourcesEngineering journalDecision guidesSolution blueprintsSalesforce productsProjects and achievementsSales ROI calculatorWhere we workChecklists and templatesPlanning toolsReadiness assessmentGlossaryAbout GeekMidstOur approachOur expertiseContact
CompanyAbout GeekMidstOur approachDelivery methodologyTrust and evidenceProjectsAchievementsBook a consultationContactWhere we workSecurity and data
Book a Consultation

Integration Error Handling Checklist

A working checklist for designing and reviewing how Salesforce integrations fail, retry, log and recover, with examples of error classification and partial-success handling.

Type
Resource
Topic
Resource
Reading time
3 min
Updated
Author
GeekMidst Team
Reviewed by
Site owner
Talk to an expert
Engineer unplugs a network cable from a test switch while watching an abstract chart dip on a monitor at night

Integrations rarely fail loudly. A token expires, a validation rule is added, a record is locked for a few seconds, and records stop arriving without anyone noticing until a customer complains. Good error handling is designed before go-live, not added after the first incident.

Use this checklist when designing a new integration with Salesforce, or when reviewing one that already runs. It applies whether the integration is point-to-point, runs through middleware, or uses platform events.

The checklist

  1. Every error is classified as transient (worth retrying) or permanent (needs a person or a code fix).
  2. Retries use backoff with jitter and a maximum number of attempts, so a struggling system is not hammered.
  3. Writes are idempotent. Use upsert on an External ID, or an idempotency key, so a retried request cannot create duplicates.
  4. Partial success is handled. Batch and composite calls can succeed for some records and fail for others; each record's result is checked.
  5. Failures are logged with context: source system, record identifier, payload reference, error code, message and timestamp, without logging secrets or unnecessary personal data.
  6. Failed messages are kept for replay, in a dead-letter queue or error table, with a tested way to resubmit them.
  7. Someone is alerted when error rates or queue depth cross a threshold, and the alert says where to look.
  8. API usage is monitored against your org's limits. Check current limits for your org in Salesforce Help or the System Overview page.
  9. Authentication failures are handled by refreshing tokens once, then alerting, rather than retrying indefinitely.
  10. There is a runbook that tells support staff how to diagnose, fix and replay each common failure.

Classifying common Salesforce errors

Typical causeRetry?Action
INVALID_SESSION_ID or HTTP 401Expired or revoked tokenOnce, after refreshRefresh the token, then alert if it fails again
REQUEST_LIMIT_EXCEEDEDAPI allocation used upLater, with backoffPause, alert and review call volume
UNABLE_TO_LOCK_ROWAnother process holds the recordYes, with backoffRetry a few times, then investigate data skew
HTTP 5xx or timeoutTemporary service or network issueYes, if the write is idempotentRetry with backoff and check for duplicates
REQUIRED_FIELD_MISSINGPayload lacks a mandatory valueNoRoute to the data owner and fix the source
FIELD_CUSTOM_VALIDATION_EXCEPTIONA validation rule rejected the dataNoRoute to the data owner or review the rule
DUPLICATE_VALUEA unique field already holds the valueNoCheck the External ID and matching logic

Reading a REST API error

The Salesforce REST API returns errors as a JSON array. The errorCode is what your classification logic should branch on; the message is for humans and may change wording.

json
[
  {
    "message": "Required fields are missing: [LastName]",
    "errorCode": "REQUIRED_FIELD_MISSING",
    "fields": ["LastName"]
  }
]
Example error body from the Salesforce REST API

Handling partial success in Apex

When Apex receives a batch of records from an inbound integration, using allOrNone = false lets valid records save while failed ones are captured. This sample assumes an Account.External_Id__c External ID field and a custom Integration_Error__c object with text fields for the identifier, status code and message. It is a pattern to adapt, not production code.

apex
public static void upsertAccounts(List<Account> records) {
    Database.UpsertResult[] results =
        Database.upsert(records, Account.External_Id__c, false);

    List<Integration_Error__c> errors = new List<Integration_Error__c>();
    for (Integer i = 0; i < results.size(); i++) {
        if (results[i].isSuccess()) {
            continue;
        }
        for (Database.Error err : results[i].getErrors()) {
            errors.add(new Integration_Error__c(
                Record_Key__c = records[i].External_Id__c,
                Status_Code__c = String.valueOf(err.getStatusCode()),
                Message__c = err.getMessage().left(255)
            ));
        }
    }
    if (!errors.isEmpty()) {
        insert errors;
    }
}
Capture per-record failures from a partial-success upsert

Workflow diagram

Explore how the pieces fit together. Select a step to read what happens there.

Workflow

Retry and error handling

Open full size
Retry and error handlingAn outbound change gets an idempotency key before the target API is called. Successful calls are marked as synced; retryable failures back off and retry with the same key, and permanent failures or exhausted retries go to a dead-letter queue, alert the support team and are replayed once fixed.Retry and error handlingSalesforceSupport teamError storeIntegration layerYesNoYesNoRetryChange to send: Record or event. An outbound integration starts from a record change or an event. Record the attempt against the source record so users can see sync status.Change to sendRecord or eventIdempotency key: Same key on retries. A unique key per business change lets the target ignore duplicates, so a retry after a timeout cannot create a second order or payment.Idempotency keySame key on retriesCall target API: With a timeout. Set an explicit timeout. A timeout does not mean the call failed; the target may have applied it, which is why the idempotency key matters.Call target APIWith a timeoutCall succeeded?. Treat a success response as success only after checking the body; some APIs return 200 with an error inside.Call succeeded?Marked synced: Status saved. The source record is marked as synced with the target ID and time, which makes support questions quick to answer.Marked syncedStatus savedRetryable, tries left?. Timeouts, rate limits and server errors are worth retrying. Validation errors are not; retrying them only fills logs. Cap the number of attempts.Retryable, triesleft?Back off, retry: Exponential, jitter. Wait longer after each failure and add some randomness, so many failed calls do not all retry at once and overload the target again.Back off, retryExponential, jitterDead-letter queue: Payload and error kept. Failed messages are parked with the payload, error, attempt count and correlation ID. Nothing is lost, and the queue can be replayed after a fix.Dead-letter queuePayload and errorkeptAlert support: With correlation ID. Alert on a growing queue or on critical failures, not on every single error, so alerts stay meaningful.Alert supportWith correlation IDFix cause, replay: Same key reused. Support fixes the data or configuration and replays from the queue. The original key means replays are safe even if some calls already landed.Fix cause, replaySame key reusedReplayed: Queue item closed. The record is synced and the queue item is closed with a note of the cause, which helps spot repeating problems.ReplayedQueue item closedStartProcess stepSystem or platformDecisionEnd or outcomeWaitDataAlert or exceptionPerson or teamOriginal GeekMidst explanatory diagram, not an official Salesforce reference.

Select any step in the diagram, or use Step through, to see what happens at that point and why.

Text version: every step in order
  1. Change to send SalesforceRecord or event

    An outbound integration starts from a record change or an event. Record the attempt against the source record so users can see sync status.

    Next: Idempotency key

  2. Idempotency key Integration layerSame key on retries

    A unique key per business change lets the target ignore duplicates, so a retry after a timeout cannot create a second order or payment.

    Next: Call target API

  3. Call target API Integration layerWith a timeout

    Set an explicit timeout. A timeout does not mean the call failed; the target may have applied it, which is why the idempotency key matters.

    Next: Call succeeded?

  4. Call succeeded? Integration layer

    Treat a success response as success only after checking the body; some APIs return 200 with an error inside.

    Next: Yes: Marked synced; No: Retryable, tries left?

  5. Marked synced SalesforceStatus saved

    The source record is marked as synced with the target ID and time, which makes support questions quick to answer.

    End of the flow.

  6. Retryable, tries left? Integration layer

    Timeouts, rate limits and server errors are worth retrying. Validation errors are not; retrying them only fills logs. Cap the number of attempts.

    Next: Yes: Back off, retry; No: Dead-letter queue

  7. Dead-letter queue Error storePayload and error kept

    Failed messages are parked with the payload, error, attempt count and correlation ID. Nothing is lost, and the queue can be replayed after a fix.

    Next: Alert support

  8. Back off, retry Integration layerExponential, jitter

    Wait longer after each failure and add some randomness, so many failed calls do not all retry at once and overload the target again.

    Next: Retry: Call target API

  9. Alert support Support teamWith correlation ID

    Alert on a growing queue or on critical failures, not on every single error, so alerts stay meaningful.

    Next: Fix cause, replay

  10. Fix cause, replay Support teamSame key reused

    Support fixes the data or configuration and replays from the queue. The original key means replays are safe even if some calls already landed.

    Next: Replayed

  11. Replayed SalesforceQueue item closed

    The record is synced and the queue item is closed with a note of the cause, which helps spot repeating problems.

    End of the flow.

An outbound change gets an idempotency key before the target API is called. Successful calls are marked as synced; retryable failures back off and retry with the same key, and permanent failures or exhausted retries go to a dead-letter queue, alert the support team and are replayed once fixed. Original GeekMidst explanatory diagram; not an official Salesforce reference architecture.

Worried about silent integration failures?

GeekMidst can review your existing integrations against this checklist, or design error handling and monitoring into a new one from the start.

Request an integration review →

Tell us what you are trying to fix.

Share your Salesforce setup, goals and constraints. A practitioner reads every message and replies with questions, first thoughts or an honest view of whether you need outside help at all.

Talk to a Salesforce Expert
Book a Consultation