Custom (Load by Script) type data source
Write a custom script to store any type of incoming data in the import set table.
When you select a Type of Custom (Load by Script), a Javascript field called Data Loader appears. You can use the data loader script to fetch data and insert it into the import set table using the import_set_table input parameter. Data may be obtained, for example, from a REST API or a file attachment.
The data loader script has four input parameters.
import_set_table: The import set table referred to in the Data Source record. The data is inserted into this table.data_source: The data source referred to in the Data Source record.import_log: The log that records information about data import activity.last_success_import_time: The last time this data source was run successfully.
The data loader script has the following methods:
addColumn: Adds a string type column to the import set table.addJSONColumn: Adds a JSON type column to the import set table.addXMLColumn: Adds an XML type column to the import set table.insert: Inserts a map (key = column name, value = column value) in the import set table.getMaximumRows(): Returns 20 when the user clicks Test load 20 records. In every other case, returns -1.
As you type the script, script auto-complete presents the choices available to you, as shown in this example: