ExternalDataSource defines connection details for data and content stored outside a Salesforce org. Salesforce Connect uses it to connect external objects to external systems, while Files Connect uses it for external content repositories. It also supports federated search, email quick actions, and product-specific virtual objects. It describes the connection, not the external records themselves.
The required type selects the adapter or data source category and determines how to interpret the remaining settings. Authentication, customConfiguration, write capability, and schema descriptors must be read in that adapter's context. They are not interchangeable options that work with every connection type.
Key Elements
| Element | What the Element Controls |
|---|---|
type |
Required. Selects the adapter or data source category. Examples include OData, OData4, SfdcOrg, and AmazonAthena. A custom adapter uses a provider class ID. DynamoDB has a documented spelling discrepancy described below. |
endpoint |
The external URL or a named credential URL, such as callout:My_Named_Credential/some_path?format=json. |
principalType |
The Identity Type setting: Anonymous, NamedCustomPrincipal, NamedUser, or PerUser. Determines whether the connection uses one credential set or multiple credential sets. |
protocol |
The external-system authentication protocol. The type-specific documentation lists NoAuthentication, Oauth, and Password; the schema exposes additional values without establishing their applicability to each adapter. |
authProvider |
References the authentication provider represented by an AuthProvider component. |
certificate |
References the certificate Salesforce supplies for each two-way SSL connection so the external system can verify the request's origin. |
namedCredential |
References a NamedCredential definition for Amazon DynamoDB or Amazon Athena. This is separate from embedding a named credential association in endpoint. |
customConfiguration |
A JSON-encoded string of adapter-specific settings, including search, timeout, pagination, compatibility, or High Data Volume configuration where applicable. |
customHttpHeaders |
Custom headers for OData 2.0 and OData 4.0 connectors. Each header has its own activation setting and a formula that determines its value. |
isWritable |
Enables create, update, and delete operations for associated external objects. External objects are read-only by default; enabling writes does not grant a user or external credential access. |
externalDataSrcDescriptors |
Child schema descriptors for Amazon DynamoDB and Amazon Athena. They describe external schema information or customize retrieval queries, rather than storing external records. |
repository |
For SharePoint Online, supports creating tables and default table fields when metadata is not accessible. |
Behavior and Constraints
Salesforce access and external authentication are separate
Only authenticated internal and external users can access this metadata type. Setting principalType to Anonymous or protocol to NoAuthentication does not remove that Salesforce authenticated-user requirement.
Read principalType together with protocol and the applicable credential configuration. The identity type alone does not establish whether a user can reach the external system. In particular, the Amazon DynamoDB and Amazon Athena examples combine Anonymous and NoAuthentication with namedCredential; those values must not be interpreted in isolation.
For cloud-based Files Connect systems, use Oauth. For on-premises Files Connect systems, use Password. A SimpleURL data source uses NoAuthentication, accesses a web server that does not require authentication, and requires Chatter to be enabled.
Credentials stored in ExternalDataSource are encrypted using automatically created, org-specific keys. For direct username/password authentication, username and password must identify an external account with sufficient privileges to access the system, perform searches, return data, and retrieve external metadata.
With OAuth, oauthScope specifies the permissions requested for the access token, oauthToken holds the access token issued by the external system, and oauthRefreshToken supports obtaining a replacement token after expiration. A requested scope is not proof that the external system granted that access.
Write capability does not grant permissions
isWritable corresponds to Writable External Objects in Setup. When enabled, it allows create, update, and delete operations on external objects associated with the connection. Those operations affect data stored outside Salesforce.
This is a connection-level capability, not a user access grant. External-system credentials and Salesforce access configuration remain separate requirements. Actual user access cannot be determined from ExternalDataSource alone.
The adapter determines the meaning of the connection
-
ODataselects the OData 2.0 adapter, andOData4selects the OData 4.0 adapter. -
SfdcOrgselects the Salesforce Connect cross-org adapter. - A custom Apex Connector Framework adapter uses the ID of a
DataSource.Providerclass intype, described asApexClassId. This is a class ID, not an Apex class developer name. -
AmazonAthenaselects the Amazon Athena adapter. DynamoDB uses inconsistent capitalization across its documented value list, schema, and example; see Documentation Inconsistencies. - Files Connect values include
ContentHubSharepointOffice365for SharePoint Online,ContentHubSharepointOneDrivefor OneDrive for Business, andContentHubGDrivefor Google Drive. -
OpenSearchrepresents federated search.outgoingemailrepresents sending email through a quick action. -
AFPPAttributerepresents the Application Form Product Proposal Attribute virtual object.ASPAttribute,OIAttribute, andQLIAttributerepresent Asset State Period Attribute, Order Item Attribute, and Quote Line Item Attribute virtual objects.SAPAttributerepresents the SalesAgreement Product Attribute virtual object. These are not general-purpose external-table adapters. - Some values, including
AssetAttribute,Identity, andWrapper, are reserved for internal use.
Interpret customConfiguration by adapter
customConfiguration contains a JSON-encoded string, not a nested XML structure. Its parameters depend on the selected adapter:
- For
SfdcOrg,apiVersionselects the connection's API version,environmentselects the target environment,searchEnabledcontrols search, andtimeoutcontrols the connection timeout. This embeddedapiVersionis connection configuration, not the Metadata API transport version. - For
ODataandOData4,csrfTokenEnabledcontrols Cross-Site Request Forgery (CSRF) protection, andcsrfTokenNamespecifies the anti-CSRF token name. - OData settings also include
paginationfor pagination behavior,inlineCountEnabledfor requesting row counts,formatfor the data format,requestCompressionfor request compression, andcompatibilityfor special compatibility behavior.timeoutsets the connection timeout. - For OData search,
searchEnabledcontrols whether search is enabled, andsearchFuncspecifies a custom query option for Salesforce search. - For OData and custom adapters,
noIdMappingcorresponds to the High Data Volume setting.
Configuration examples are not defaults. Sample timeout, pagination, and format values do not establish required settings for every external service.
Custom HTTP headers use formulas
customHttpHeaders applies to OData 2.0 and OData 4.0 connectors. Each entry requires headerFieldName and headerFieldValue. The header name must contain at least one alphanumeric character or underscore and can also contain the documented HTTP header symbols.
headerFieldValue is a formula that must evaluate to a string, not merely a literal header value. For example, $User.Username makes the value depend on the current user. If the formula resolves to null or an empty string, Salesforce does not send the header.
Each header's isActive setting controls whether it is available for use. A missing outbound header can therefore result from either its activation setting or its formula evaluation.
AWS schema descriptors are child configuration
externalDataSrcDescriptors contains schema descriptors for Amazon DynamoDB and Amazon Athena. Within each descriptor:
-
descriptoris required and contains the descriptor document. -
typeis required and has the valueSchema. This is distinct from the top-leveltypethat selects the adapter. -
subtypeis required.SchemaTableMetadatacaches information about the external system;SchemaTableQualifierscustomizes the retrieval query sent to that system. -
customObjectoptionally associates the descriptor with an external-objectCustomObjectdefinition. -
externalDataSourceis required and names the associated connection.developerNameis required and uniquely identifies the child-level setup entity. -
systemVersionis required and identifies the descriptor format for compatibility.
The optional descriptorVersion tracks the external system's schema version when that system supports schema versioning. Several descriptors with different document versions can be active simultaneously. Neither descriptorVersion nor systemVersion is the top-level version element, which is reserved for future use.
Deployment and Retrieval
In a Metadata API package, components are stored in the dataSources directory with the suffix .dataSource. The filename prefix is the external data source's name, for example dataSources/MyDataSource.dataSource. The type inherits fullName from Metadata; label supplies the name displayed in the Salesforce user interface.
Use ExternalDataSource as the type name in package.xml. This type supports the wildcard member * in the manifest.
The connection definition is separate from its external-object CustomObject definitions and from the external records. Relevant dependencies can include the authentication provider, certificate, named credential, and custom adapter class. External objects identify their connection through their own externalDataSource element.
Keep descriptor fields in their child container. The customObject and externalDataSource references described for AWS schema descriptors belong inside externalDataSrcDescriptors; they are not top-level ExternalDataSource elements. Likewise, the child's type value of Schema must not replace the top-level adapter value.
A named credential association can take two forms. endpoint can contain callout:My_Named_Credential, an optional path, and an optional query string introduced by ?. Amazon DynamoDB and Amazon Athena also use the separate namedCredential element. These configurations must be interpreted with the selected adapter and authentication settings.
Relationships
An external object connects to ExternalDataSource, which in turn connects to applicable authentication, certificate, or named credential configuration. Permission-related incoming references are separate from the credentials stored on the connection and do not make the connection definition a complete account of user access.
References
-
AuthProvider:authProvider. -
Certificate:certificate. -
CustomObject:customObjectinsideexternalDataSrcDescriptors. -
ExternalDataSource:externalDataSourceinsideexternalDataSrcDescriptors. -
NamedCredential:namedCredentialfor Amazon DynamoDB and Amazon Athena.
Separately, endpoint can embed a name-based association to a named credential using the callout: syntax. A custom adapter also associates the connection with an ApexClass through the provider class ID stored in type, rather than through a class developer name.
Referenced By
-
CustomObject:externalDataSourceon an external-object definition. -
ExternalDataSource:externalDataSourceinside a child schema descriptor. -
MutingPermissionSet:externalDataSource. -
PermissionSet:externalDataSource.
Documentation Inconsistencies
-
DynamoDB adapter capitalization differs. The documented
typevalue list usesAmazonDynamoDB, while the schema and declarative example useAmazonDynamoDb. Do not silently normalize the case; the two spellings are not documented consistently. -
The protocol list is narrower than the schema enumeration. The type-specific documentation lists
NoAuthentication,Oauth, andPassword. The schema additionally exposesAwsSv4,Basic,Custom,Jwt, andJwtExchange, but does not establish which adapters accept those additional values.
Common Questions
How do I retrieve all ExternalDataSource components?
Use ExternalDataSource in package.xml with the wildcard member *. Metadata API package files use the dataSources directory and .dataSource suffix. These files define connections, not external records.
Does Anonymous or NoAuthentication allow guest access?
No. Only authenticated internal and external Salesforce users can access this metadata type. Those settings describe external-system authentication and must be read with the adapter and credential configuration.
Why can't a user edit an external object when isWritable is true?
isWritable enables connection-level create, update, and delete capability. It does not grant Salesforce user access or external-system privileges. Both remain separate from that setting.
Why is my custom HTTP header not being sent?
For OData 2.0 and OData 4.0 connections, check the header's isActive setting and its headerFieldValue formula. Salesforce does not send the header if the formula resolves to null or an empty string.
Where do customObject and externalDataSource belong in an AWS connection file?
For AWS schema descriptors, those elements belong inside externalDataSrcDescriptors, not at the top level. The descriptor's type is Schema; the top-level type selects the adapter.