---
sourceDocument: Brazil Workflow Data Fabric
sourceDocumentLink: https://www.servicenow.com/docs/r/integrate-applications

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil Workflow Data Fabric

ft:clusterId :

    - crint

bundleId :

    - crint

workflow :

    - Creator


---

# Custom (Load by Script) type data source

# Custom (Load by Script) type data source {#ariaid-title1}

Release version: Brazil  
Updated September 10, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Custom (Load by Script) type data source

The Custom (Load by Script) data source in ServiceNow enables you to import any type of data by writing a JavaScript script that fetches and inserts data into an import set table.
This flexibility allows integration with various data sources such as REST APIs or file attachments.
The key feature is theData Loaderscript field where you define the logic for data retrieval and insertion.
Show full answer Show less  

## Key Features

* **Data Loader Script:** A JavaScript script that inserts data into the import set table using the `importsettable` parameter. It supports adding columns of type string, JSON, or XML and inserting rows as key-value pairs.
* **Parallel Loading:** Supports partitioning data into smaller chunks to load in parallel, reducing integration time and minimizing impact on other system tasks. Parallel loading requires the import to be concurrent and the partition method set to Custom size.
* **Input Parameters:** Scripts have access to parameters like `importsettable`, `datasource`, `importlog`, `lastsuccessimporttime`, and `partitioninfo` for data handling and logging.
* **Parallel Job Management:** Use a parallel loading script to add partition jobs with optional delays to the Parallel Jobs table. Delays help handle data availability timing and avoid repetitive loops by applying constraints on partitions.
* **Job Monitoring and Configuration:** You can monitor parallel import jobs in the Concurrent Import Sets table and Events queue. Automatic retries and timeout behaviors can be configured through system properties for handling stuck or failed parallel jobs.
* **Script Auto-Complete:** An integrated auto-complete feature assists in writing Data Loader scripts by showing available options dynamically.

## Practical Application for ServiceNow Customers

This functionality empowers you to create highly customizable, script-driven data imports tailored to complex or non-standard data sources. Parallel loading significantly improves import efficiency, especially for large datasets or integrations requiring minimal disruption. Monitoring and controlling parallel job execution ensures reliability and manageability of your import processes.

To implement, write your Data Loader script to fetch and insert data, optionally leverage parallel loading for partitioned imports, and use the provided system properties and monitoring tools to fine-tune and maintain your import jobs.  
Use 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) for your data source, the Data Loader field appears. The Data Loader field is a
JavaScript field where you can enter a script to fetch data and insert it into the import set table using the import_set_table input parameter. For example, you can enter a script to get data from a REST API
or a file attachment.  
The Data Loader script loads the data. You can also Enable parallel loading to use a script to partition the data into smaller sections, then load them in parallel. Parallel loading can enable your integrations to finish in less time and create less of an impact on other tasks. Parallel jobs are usually processed immediately. If you need to delay a job, you can configure a delay in the Data Loader script.  
Note:  
With parallel loading, you must be running a concurrent import and the Partition Method for the import must be set to Custom size. For more information see, [Schedule a data import](https://www.servicenow.com/docs/eoOoCekJL66azyC8Pfknaw "Schedule imports to make it possible to specify that certain import operations occur at a regular interval.").

## Data Loader script {#custom-type-data-source__section_z3b_zr1_z1c}

The data loader script has the following 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.
* `partition_info`: The partitioning information for the data. Used for parallel loading.
{#custom-type-data-source__ul_lzd_32x_mtb}  
The import_set_table parameter has the following methods:

* `addColumn(label, maxLength)`: Adds a string-type column to the import set table.
* `addJSONColumn(label, maxLength)`: Adds a JSON-type column to the import set table.
* `addXMLColumn(label, maxLength)`: Adds an XML-type column to the import set table.
* `insert(rowData)`: Inserts a map (key = column name, value = column value) in the import set table.
* `getMaximumRows()`: Returns 20 when you select Test load 20 records. In every other case, returns -1.
{#custom-type-data-source__ul_wj1_ct1_gjb}

## Data Loader example {#custom-type-data-source__section_fpk_xr1_z1c}

## Parallel loading script {#custom-type-data-source__section_cdn_ls1_z1c}

The parallel loading script has the following input parameters.

* `parallel_job_loader`: The Parallel Jobs \[sys_parallel_job\] 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.
{#custom-type-data-source__ul_xt3_4s1_z1c}

The parallel_job_loader parameter has the `add(partitionInfo)` method, which adds the partition information to the Parallel Jobs \[sys_parallel_job\] table.

## Parallel loading example {#custom-type-data-source__section_old_ys1_z1c}

In this example, the parallel loading script partitions the data into smaller sections to be loaded in parallel. The Data Loader script loads the data into the import set table and adds a new partition to process data after a
120-second delay.

## Parallel loading delays, status, and properties {#custom-type-data-source__section_xsy_ys1_z1c}

For most parallel jobs, data is available when the Data Loader script runs, so you don't need to add any parallel jobs to the Data Loader script.

In cases where the data might not be immediately available, you can create an additional parallel job with a delay in the Data Loader script. When the Data Loader script runs, the parallel job is scheduled to run after the
amount of time specified by the delay.

When adding parallel jobs to the Data Loader script, avoid repetitive loops. You can avoid repetitive loops by specifying a constraint. In the previous example, the parallel job in the Data Loader script uses the constraint 
`(partition.start < 1000)`. Delays are measured in seconds.

You can check the status of your current parallel import tasks by going to the Concurrent Import Sets \[sys_concurrent_import_set\] table, selecting your job, and viewing the Parallel Jobs tab.

Delayed jobs may show as Pending depending on the delay's length of time. Parallel jobs are processed from the event queue, so you can also view your jobs by going to the Events \[sysevent\] table and
filtering by \[Queue\] \[is\] \[impex_parallel_job_queue\].

If a job gets stuck in a Running state for more than 600 minutes, it's automatically put back into a Pending state. You can modify the amount of time a parallel job is allowed to be
stuck in a running state with the com.glide.system_parallel_job_inactive_time_minutes property.

If a parallel job can't complete after two tries, the job is set to **Error** . You can modify the number of tries before having an error state with the com.glide.system_parallel_job_max_retry_count
property. The com.glide.system_parallel_job_auto_retry property can be set to false to disable auto retry.

## Script auto-complete {#custom-type-data-source__section_xmh_js1_z1c}

As you type the script, the script auto-complete displays the available options, as shown in this example.


