External data sources

External data sources should be used when you want to retrieve data from an external server and present it alongside data from a standard or custom Salesforce object. Since the datasource is accessed using a user-defined Apex class, you can retrieve data more flexibly compared to an internal datasource.

For example, if you want to retrieve real-time inventory numbers from an external system and display them on-screen alongside your product information, you can write REST API code in an Apex Class to do this.

  • Properties

    Describes the properties to be configured when using an external datasource.

  • Creating an Apex class

    Before you can use an external datasource, you must write an Apex class. Your class must implement the SBLD.DataSourceService.Fetchable interface provided in the package.


Properties

There are several properties to be configured when using an external datasource.

Apex class for an external datasource
Flow for an external datasource
Field name or area
Description
Req.

Select the type of external connection.

There are two ways to connect to external datasources.

  • Apex - use an Apex class that implements the SBLD.DataSourceService.Fetchable interface.

  • Flow - use an automatically executing Flow.

✔️

Enable

Enables the datasource. A disabled datasource will not be available when building custom lists.

Description

Provide a description of your datasource.

Key Field

Specifies which fields from the List object should be matched with fields from the datasource.

✔️

Parameters

If your datasource needs to be passed values from fields in the List object, select those fields here.

Input Variable

Select the parameter variables to pass to the Flow. If no parameters are required, leave unchecked. 💡 The displayed options are those marked "Available for input" in the Flow.

Output Variable

Select the variables to receive the results from the Flow. 💡 The displayed options are those marked "Available for output" in the Flow.

✔️

Creating an Apex class

Before you can use an external datasource, you must write an Apex class. Your class must implement the SBLD.DataSourceService.Fetchable interface provided in the package.

You must also implement the execute() method in your class.

You can get information from the Parent or Lookup objects through the gets() method in SBLD.DataSourceService.Parameter

To pass the result to the Line-Item Configurator, we use the class below.

SBLD.DataSourceServiceAction Class

Specifies an Action for each line in the target (Lookup or Line-item). An Action is an operation that maps a DataSource value to a Lookup or Line-item field.

  • setKeyValue(Object keyValue) Sets the Key value to find the target record for the Lookup or Line-item.

  • putSourceToTargetField(Object sourceValue, String targetField) Assigns a data source value to a Lookup or Line-item field.

SBLD.DataSourceService.Result Class

Adds the mapped Action to the return value.

  • addAction(SBLD.DataSourceServiceAction action) Adds an Action to the SBLD.DataSourceService.Result instance.

Example

Under construction! Contact us if you need further help.

Last updated

Was this helpful?