Connection Class
Extend this class to enable your Salesforce org to sync the external system’s schema and to handle queries, searches, and write operations (upsert and delete) of the external data. This class extends the DataSourceUtil class and inherits its methods.
Your DataSource.Connection and DataSource.Provider classes compose a custom adapter for Salesforce Connect.
Changing the sync method on the DataSource.Connection class doesn’t automatically resync any external objects.
The following are methods for Connection.
-
Invoked when external object records are deleted via the Salesforce user interface, APIs, or Apex.
-
Invoked by a SOQL query of an external object. A SOQL query is generated and executed when a user visits an external object’s list view or record detail page in Salesforce. Returns the results of the query.
-
Invoked by a SOSL query of an external object or when a user performs a Salesforce global search that also searches external objects. Returns the results of the query.
-
Invoked when an administrator clicks Validate and Sync on the external data source detail page. Returns a list of tables that describe the external system’s schema.
-
Invoked when external object records are created or updated via the Salesforce user interface, APIs, or Apex.
Invoked when external object records are deleted via the Salesforce user interface, APIs, or Apex.
public List<DataSource.DeleteResult> deleteRows(DataSource.DeleteContext deleteContext)
-
deleteContext:
Type: DataSource.DeleteContext
Contains context information about the delete request.
Type: List<DataSource.DeleteResult>
The results of the delete operation.
Invoked by a SOQL query of an external object. A SOQL query is generated and executed when a user visits an external object’s list view or record detail page in Salesforce. Returns the results of the query.
public DataSource.TableResult query(DataSource.QueryContext queryContext)
-
queryContext:
Type: DataSource.QueryContext
Represents
the query to run against a data table.
Type: DataSource.TableResult
Invoked by a SOSL query of an external object or when a user performs a Salesforce global search that also searches external objects. Returns the results of the query.
public List<DataSource.TableResult> search(DataSource.SearchContext searchContext)
-
searchContext:
Type: DataSource.SearchContext
Represents
the query to run against an external data table.
Type: List<DataSource.TableResult>
Invoked when an administrator clicks Validate and Sync on the external data source detail page. Returns a list of tables that describe the external system’s schema.
public List<DataSource.Table> sync()
Type: List<DataSource.Table>
Each returned table can be used to create an external object in Salesforce. On the Validate External Data Source page, the administrator views the list of returned tables and selects which tables to sync. When the administrator clicks Sync, an external object is created for each selected table. Each column within the selected tables also becomes a field in the external object.
Invoked when external object records are created or updated via the Salesforce user interface, APIs, or Apex.
public List<DataSource.UpsertResult> upsertRows(DataSource.UpsertContext upsertContext)
-
upsertContext:
Type: DataSource.UpsertContext
Contains context information about the upsert request.
Type: List<DataSource.UpsertResult>
The results of the upsert operation.