---
schema_version: "1"
id: 6784eed664227e959a1679975f1ca4f36e2a2648405b91755af88902f56a552c
title: Define an External Data Source for Salesforce Connect—Custom Adapter
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/apex_add_external_data_source.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.apex_add_external_data_source.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 33a5906558da1ecf9cc134a933e9a5966e0536f63db305a30a649e22b34cf3c3
description: Connect your Salesforce org to any data anywhere via a Salesforce Connect custom adapter that you create with the Apex Connector Framework.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Define an External Data Source for Salesforce Connect—Custom Adapter

Connect your Salesforce org to any data anywhere via a Salesforce Connect custom adapter that you create with the Apex Connector Framework.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition">
        <colgroup>
          <col>
        </colgroup>
        <tbody>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic and Lightning Experience</td>
          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">
              <p>Available in: <strong>Developer</strong> Edition</p>
              <p style="margin-bottom:0;">Available for an extra cost in:
                <strong>Enterprise</strong>, <strong>Performance</strong>, and <strong>Unlimited</strong> Editions
              </p>
            </td>
          </tr>
        </tbody>
      </table> <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d43471e55">User Permissions
              Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e55 ">To create and edit external data sources:</td>
            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e55 ">Customize Application</td>
          </tr>
        </tbody>
      </table>

Before you begin, develop the custom adapter for Salesforce Connect. If the custom adapter uses Apex callouts, also define remote sites for the callout endpoints. See [Set Up Salesforce Connect to Access External Data with a Custom Adapter](https://help.salesforce.com/s/articleView?id=platform.apex_adapter_setup.htm&release=264.0.0&type=5 "Let users view, search, and modify any data anywhere from within their Salesforce org.").

1. From Setup, enter External Data Sources in the Quick Find box, then select **External Data Sources**.
2. Click **New External Data Source**, or click **Edit** to modify an existing external data source.
3. Complete the fields.
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:25%">
              <col style="width:75%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d43471e120">Field</th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d43471e123">Description</th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e120 ">
                  <samp class="parmname">Label</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e123 ">
                  <p>A user-friendly name for the external data source. The label is displayed
                    in the Salesforce user interface, such as in list views.</p>
                  <p style="margin-bottom:0;">If you set
                    <samp class="parmname">Identity Type</samp> to Per User, this label appears when your
                    users view or edit their authentication settings for external
                    systems.
                  </p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e120 ">
                  <samp class="parmname">Name</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e123 ">
                  <p>A unique identifier that’s used to refer to this external data source
                    definition through the API.</p>
                  <p style="margin-bottom:0;">The name can contain only underscores and
                    alphanumeric characters. It must be unique, begin with a letter, not include
                    spaces, not end with an underscore, and not contain two consecutive
                    underscores.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e120 ">
                  <samp class="parmname">Type</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e123 ">
                  <p>Select <strong class="uicontrol">Salesforce Connect: Custom—&lt;your
                      DataSource.Provider class name&gt;</strong>.</p>
                  <p style="margin-bottom:0;">If you change and save a
                    <code>DataSource.Connection</code> class, resave
                    the corresponding <code>DataSource.Provider</code>
                    class. Otherwise, when you define the external data source, the custom adapter
                    doesn’t appear as an option for the <samp class="parmname">Type</samp>
                    field.
                  </p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e120 ">
                  <samp class="parmname">URL</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e123 ">
                  <p>URL of the external system.</p>
                  <p>Available only when the <code>DataSource.Provider</code> class declares the
                    <code>REQUIRE_ENDPOINT</code> capability. If the
                    class also declares the <code>REQUIRE_HTTPS</code>
                    capability, the URL must begin with <kbd>https://</kbd>.
                  </p>
                  <p>If
                    the endpoint is defined in a named credential, enter the named credential URL.
                    <span id="apex_add_external_data_source__named_credential_url"><a name="apex_add_external_data_source__named_credential_url"><!-- --></a>A named credential URL contains the scheme
                      <code>callout:</code>, the name of the named
                      credential, and an optional path. For example: <code>callout:</code><var>My_Named_Credential</var><code>/</code><var>some_path</var>.</span>
                  </p>
                  <p style="margin-bottom:0;">You
                    can append a query string to a named credential URL. Use a question mark (?)
                    as the separator between
                    the named credential URL and the query string. For example: <code>callout:</code><var>My_Named_Credential</var><code>/</code><var>some_path</var><code>?format=json</code>.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e120 ">
                  <samp class="parmname">Writable External Objects</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e123 ">The Lightning Platform and users in this org can create, update, and delete
                  records for external objects associated with the external data source. The
                  external object data is stored outside the org. By default, external objects are
                  read only.</td>

              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e120 ">
                  <samp class="parmname">High Data Volume</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e123 ">Salesforce enforces rate limits for retrieving and viewing data from
                  external systems. <span id="apex_add_external_data_source__field_high_data_volume_when_select"><a name="apex_add_external_data_source__field_high_data_volume_when_select"><!-- --></a>If your org hits
                    rate limits when accessing external objects, consider selecting the
                    <strong class="uicontrol">High Data Volume</strong> option on the associated external
                    data sources.</span> Doing so bypasses most rate limits, but some special
                  behaviors and limitations apply. See <a href="https://help.salesforce.com/s/articleView?id=platform.apex_considerations_high_data_volume.htm&amp;release=264.0.0&amp;type=5" title="If your org hits rate limits when accessing external objects, consider selecting the High Data Volume option on the associated external data sources. Doing so bypasses most rate limits, but some special behaviors and limitations apply.">High Data Volume Considerations for Salesforce Connect—Custom
                    Adapters</a>.</td>

              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e120 ">
                  <samp class="parmname">Certificate</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e123 ">
                  <p>If you specify a certificate, your Salesforce org supplies it when
                    establishing each two-way SSL connection with the external system. The
                    certificate is used for digital signatures, which verify that requests are
                    coming from your Salesforce org.</p>
                  <p style="margin-bottom:0;">Available only when the <code>DataSource.Provider</code> class declares the
                    <code>CERTIFICATE</code> authentication
                    capability.
                  </p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e120 ">
                  <samp class="parmname">Identity Type</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e123 ">
                  <p>Determines whether you're using one set or multiple sets of credentials to
                    access the external system. See <a href="https://help.salesforce.com/s/articleView?id=platform.platform_connect_identity_type.htm&amp;release=264.0.0&amp;type=5" title="On the external data source configured for Salesforce Connect, the Identity Type field specifies whether your organization uses one set or multiple sets of credentials to access the external system. Each set of credentials corresponds to a login account on the external system.">Identity Type for External Data Sources</a>.</p>
                  <p style="margin-bottom:0;">Available only when the
                    <code>DataSource.Provider</code> class declares
                    the <code>BASIC</code> or <code>OAUTH</code> authentication capability.
                  </p>
                </td>

              </tr>
            </tbody>
          </table>
4. Select the authentication protocol.
    
    - If you select **Password Authentication**, enter the username and password for accessing the external system.
        
        Password authentication is available only when the `DataSource.Provider` class declares the `BASIC` authentication capability.
    - If you select **OAuth 2.0**, complete the following fields.
        
        OAuth 2.0 is available only when the `DataSource.Provider` class declares the `OAUTH` authentication capability.
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:25%">
              <col style="width:75%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d43471e391">Field</th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d43471e394">Description</th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e391 ">
                  <samp class="parmname">Authentication Provider</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e394 ">Choose the provider. See <a href="https://help.salesforce.com/s/articleView?id=experience.sso_authentication_providers.htm&amp;type=5&amp;language=en_US" target="_blank">Authentication Providers</a>.</td>

              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e391 ">
                  <samp class="parmname">Scope</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e394 ">
                  <p>Specifies the scope of permissions to request for the access token. Your
                    authentication provider determines the allowed values. See <a href="https://help.salesforce.com/s/articleView?id=xcloud.sso_provider_addl_params_scope.htm&amp;type=5&amp;language=en_US" target="_blank">Use the Scope Parameter</a>.</p>
                  <p>Keep these
                    considerations in mind when you set a scope.</p>
                  <ul>
                    <li>The value that you enter replaces the <samp class="parmname">Default Scopes</samp>
                      value that’s defined in the specified authentication provider.</li>
                    <li>Whether scopes are defined can affect whether each OAuth flow prompts the
                      user with a consent screen.</li>
                    <li>We recommend that you request a refresh token or offline access.
                      Otherwise, when the token expires, you lose access to the external
                      system.</li>
                  </ul>
                </td>

              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e391 ">
                  <samp class="parmname">Start Authentication Flow on Save</samp>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d43471e394 ">
                  <p>To authenticate to the external system and obtain an OAuth token, select
                    this checkbox. This authentication process is called an OAuth flow.</p>
                  <p>When you
                    click <strong class="uicontrol">Save</strong>, the external system prompts you to log in.
                    After successful login, the external system grants you an OAuth token for
                    accessing its data from this org.</p>
                  <p style="margin-bottom:0;">Redo the OAuth flow when you need a
                    new token—for example, if the token expires—or if you edit the
                    <samp class="parmname">Scope</samp> or <samp class="parmname">Authentication Provider</samp>
                    fields. When the token expires, the external system returns a 401 HTTP error
                    status.
                  </p>
                </td>

              </tr>
            </tbody>
          </table>
5. Click **Save**.
6. Click **Validate and Sync**, and confirm that the connection is successful.
    
    This step also invokes the `sync()` method on the `DataSource.Connection` class to obtain the list of tables that you can sync to create external objects and their fields.
7. Optionally, select tables and click **Sync** to do the following for each selected table.
    
    - Automatically create a Salesforce external object.
    - Automatically create a custom field for each table column that’s compatible with a Salesforce metadata field type.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_note.png)
    
    Note Before you sync, make sure that you understand the considerations that are described in these topics.
    
    - [Sync an External Data Source for Salesforce Connect](https://help.salesforce.com/s/articleView?id=platform.platform_connect_considerations_sync.htm&release=264.0.0&type=5 "When you validate and sync an external data source, it creates or overwrites Salesforce external objects that map to the external system’s schema. Syncing doesn’t copy any data into your Salesforce org or write data from your org to the external system.")
    - [Sync Considerations for Salesforce Connect—Custom Adapter](https://help.salesforce.com/s/articleView?id=platform.apex_considerations_sync.htm&release=264.0.0&type=5 "When you validate and sync an external data source of type Salesforce Connect: Custom, some special behaviors and limitations apply.")
    
    You can instead choose to manually create the external objects and custom fields that map to the external data. Doing so lets you customize the external object names, decide which table columns to create custom fields for, and customize the custom field names. However, this approach takes longer and requires manual maintenance.

#### See Also

- [Set Up Salesforce Connect to Access External Data with a Custom Adapter](https://help.salesforce.com/s/articleView?id=platform.apex_adapter_setup.htm&release=264.0.0&type=5 "Let users view, search, and modify any data anywhere from within their Salesforce org.")
- [Store Authentication Settings for External Systems](https://help.salesforce.com/s/articleView?id=platform.external_authentication.htm&release=264.0.0&type=5 "You or your administrator can set up and manage your authentication settings for external systems. With valid authentication settings, you can access external systems from within your Salesforce org.")
- [Named Credentials](https://help.salesforce.com/s/articleView?id=xcloud.named_credentials_about.htm&type=5&language=en_US)