External IDs for Lightning Connect External Objects

When you access external data with a custom adapter for Lightning Connect, the values of the External ID standard field on an external object come from the DataSource.Column named ExternalId.

Each external object has an External ID standard field. Its values uniquely identify each external object record in your organization. When the external object is the parent in an external lookup relationship, the External ID standard field is used to identify the child records.

Important

Important

  • The custom adapter’s Apex code must declare the DataSource.Column named ExternalId and provide its values.
  • Don’t use sensitive data as the values of the External ID standard field, because Salesforce sometimes stores those values.
    • External lookup relationship fields on child records store and display the External ID values of the parent records.
    • For internal use only, Salesforce stores the External ID value of each row that’s retrieved from the external system. This behavior doesn’t apply to external objects that are associated with high-data-volume external data sources.

Example

This excerpt from a sample DataSource.Connection class shows the DataSource.Column named ExternalId.
    override global List<DataSource.Table> sync() {
        List<DataSource.Table> tables =
        new List<DataSource.Table>();
    List<DataSource.Column> columns;
    columns = new List<DataSource.Column>();
    columns.add(DataSource.Column.text('title', 255));
    columns.add(DataSource.Column.text('description',255));
    columns.add(DataSource.Column.text('createdDate',255));
    columns.add(DataSource.Column.text('modifiedDate',255));
    columns.add(DataSource.Column.url('selfLink'));
    columns.add(DataSource.Column.url('DisplayUrl'));
    columns.add(DataSource.Column.text('ExternalId',255));
    tables.add(DataSource.Table.get('googleDrive','title',
        columns));
    return tables;
    }
Previous
Next