Data import scripting options

Scheduled Import Pre and Post scripts have access to multiple JavaScript objects.

Table 1. Data import scripting options
Object Description Example
cancel Set this object to true to stop the import action. Use the Pre script field to evaluate the conditions of the import and determine whether to cancel the import process. To cancel the import process, use the following call:
cancel = true;
glide.scheduled_import.stop_on_error Set this object to true to stop the import process when the parent scheduled import generates an error. One import set can depend on the results of another import set. Use the following code to stop the current import set when the parent import set generates an error.
glide.scheduled_import.stop_on_error = true;
import_set Get the GlideRecord object for the new import set. This variable allows you to query the following columns from the sys_import_set table:
  • number
  • sys_id
  • state
  • table_name
If you want to use information from the import set, you can specify one of the properties of the import_set variable.
var x = import_set.number;
data_source Specify the data source you want the scheduled import to use. The data source must be an existing GlideRecord object. Typically, you define the data source with the Scheduled Data Import record. If you want to override this data source and use another data source in certain conditions, you can use the following call:
data_source = "Example LDAP Users";