Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Apex Connector Framework entry
How-to guide

How to build an Apex Connector Framework adapter

Building a working custom adapter is a few hundred lines of Apex plus standard Setup configuration. The hard work is mapping the backend semantics onto the framework's Table, Column, and Filter abstractions.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated May 19, 2026

Building a working custom adapter is a few hundred lines of Apex plus standard Setup configuration. The hard work is mapping the backend semantics onto the framework's Table, Column, and Filter abstractions.

  1. Set up the Named Credential

    Setup, Named Credentials. Create a Named Credential with the backend URL and auth profile. The custom adapter references this credential by name for every callout.

  2. Write the DataSource.Provider class

    Extend DataSource.Provider. Declare capabilities, return a DataSource.Connection instance, and implement getAuthenticationCapabilities and getCapabilities.

  3. Write the DataSource.Connection class

    Extend DataSource.Connection. Implement sync, query, search, upsertRows, deleteRows as needed. Translate framework callbacks into REST or SOAP calls to the backend.

  4. Register the custom adapter in Setup

    Setup, External Data Sources. Click New, choose Type Custom Adapter, and select the Provider class. Save and click Validate and Sync.

  5. Sync External Objects and test

    After sync, External Objects appear in Object Manager. Run a SOQL query against one, verify the backend call fires, and confirm the returned data matches expectations.

Mandatory fields
DataSource.Provider classrequired

Top-level Apex class declaring capabilities and returning a Connection.

DataSource.Connection classrequired

Implements sync, query, search, and optional DML operations.

Named Credentialrequired

Holds backend URL and auth profile referenced by the connector.

External Data Sourcerequired

Setup record that ties the Custom Adapter type to the Provider class.

External Objectsrequired

Salesforce objects auto-generated by sync from the backend schema.

Gotchas
  • Anything the connector cannot push down to the backend (a filter the API does not support) must be applied on the Apex side. Forgetting this returns wrong results.
  • Writes need the External Data Source flagged Writable plus upsertRows and deleteRows implementations. Read-only adapters cannot accept DML.
  • External Object queries share governor limits with the calling transaction. A heavy Lightning page that loads three External Objects can exhaust CPU time.
  • Schema changes on the backend require a re-sync. Adding a column to the backend without re-syncing leaves the External Object's schema stale.

See the full Apex Connector Framework entry

Apex Connector Framework includes the definition, worked example, deep dive, related terms, and a quiz.