Import Sets in ServiceNow: Complete Guide to Bulk Data Loading

Import Sets are how you load bulk data into ServiceNow from CSV files, Excel spreadsheets, JDBC database connections, or REST API sources. Done correctly they are reliable and efficient. Done incorrectly they create duplicate records and data quality problems that take weeks to clean up. This guide covers the complete process from staging to target, coalesce keys, transform scripts, scheduled loads, and error handling. See our guide on the most common coalesce mistake.

The Import Set process

External Data Source (CSV, Excel, JDBC, REST)
  → Import Set Table (staging area — raw untransformed data)
  → Transform Map (mapping + transformation logic)
  → Target Table (incident, cmdb_ci, sys_user, etc.)

The Import Set Table is a temporary staging table that holds the raw imported data before transformation. Always review the data in the staging table before running the transform — it is much easier to catch problems here than after they have been written to production tables.

Creating a staging table and loading data

  1. Navigate to System Import Sets > Load Data
  2. Select or create an Import Set table (or let ServiceNow create one from CSV column headers)
  3. Select the data source: File, FTP, JDBC, or REST
  4. Upload your file or configure the connection
  5. ServiceNow creates Import Set rows — one per source row

Transform Maps — the mapping layer

The Transform Map defines how staging columns map to target table fields. Navigate to System Import Sets > Transform Maps > New.

Key Transform Map settings:

  • Source table — the staging table
  • Target table — where records will be created or updated
  • Field maps — each field map has a source field, target field, and optionally a coerce script

Coalesce keys — the most important setting

A coalesce key prevents duplicate records. If a field is marked as a coalesce key, ServiceNow checks whether a record already exists in the target table with the same value for that field. If it does, it updates that record instead of creating a new one.

// Example: importing user data
// Coalesce on: email (unique per user)
// If email matches existing user → UPDATE
// If email not found → INSERT new user

// Example: importing CIs
// Coalesce on: serial_number
// If serial_number matches existing CI → UPDATE
// If not found → INSERT new CI

Without a coalesce key, every import run creates new records regardless of whether they already exist — leading to thousands of duplicates. Always set at least one coalesce field.

Choosing the right coalesce key

A good coalesce key must be:

  • Unique in the source data (no two source rows have the same value)
  • Stable — it does not change between imports (email address is stable; display name is not)
  • Present on all records — null coalesce keys always create new records

Transform scripts

Transform Map field mappings handle simple value transfers. Transform Scripts handle everything else — data cleaning, conditional logic, lookups, and relationship creation.

// onBefore script — runs before each record transforms
// Use to: skip invalid records, set defaults, clean data

// Skip records with no email address
if (!source.email || source.email.trim() === '') {
    ignore = true;
    return;
}

// Clean phone number format
source.phone = source.phone.replace(/[^0-9+]/g, '');

// Map status code from source to ServiceNow state
if (source.status == 'OPEN') {
    target.state = 1;
} else if (source.status == 'RESOLVED') {
    target.state = 6;
} else {
    ignore = true; // Skip unknown statuses
    return;
}

// onAfter script — runs after each record transforms
// Use to: create related records, update other tables
if (action == 'insert') {
    // Create a welcome task for new users
    var task = new GlideRecord('task');
    task.setValue('short_description', 'Onboard: ' + target.name);
    task.insert();
}

Scheduled data loads

For recurring imports (daily HR file, nightly CMDB sync), create a Data Source record pointing to an FTP location or REST endpoint, then schedule it using a Scheduled Import:

  1. Navigate to System Import Sets > Administration > Data Sources > New
  2. Configure the source: FTP, JDBC, REST, or file server
  3. Create a Scheduled Import that points to the Data Source and Transform Map
  4. Set the schedule (daily, weekly, etc.)

Error handling and monitoring

After each transform run, check the Import Set log for errors. Records that fail transformation appear in the import set with an Error status and an error message explaining what failed. Common errors:

  • Reference field value not found (e.g., assignment_group name does not match any group)
  • Mandatory field missing
  • Coerce script exception
  • ACL preventing insert/update

Related guides:

Transform map scripting — onBefore, onAfter, field mapping scripts

Transform maps can execute scripts at multiple points in the transformation process. Understanding when each fires is essential for complex data mapping:

// onBefore example — look up department sys_id before mapping
var deptName = source.u_department;
var dept = new GlideRecord('cmn_department');
dept.addQuery('name', deptName);
dept.query();
if (dept.next()) {
    var deptId = dept.getUniqueValue();
    ignore = false; // process this row
} else {
    error = true;  // mark row as error
    error_message = 'Department not found: ' + deptName;
}

Handling import errors and exceptions

Transform maps expose special variables in scripts to control row processing: ignore (skip this row without error), error and error_message (mark the row as failed with a message), and source_record_id (the sys_id of the source Import Set row being processed). Use these to build robust import processes that provide meaningful error reporting instead of silently dropping bad records or failing entire batches on individual row errors.

Scheduled data imports

For recurring integrations — daily syncs from HR systems, hourly feeds from monitoring tools, nightly customer data updates — combine Import Sets with a Scheduled Import. The Scheduled Import record specifies the Data Source, the Transform Map, and the schedule. The Data Source can be a file retrieved via FTP/SFTP, a REST API call result, or a file dropped in a monitored directory via MID Server. This is the standard pattern for production recurring integrations where the source system cannot push data to ServiceNow via REST.

Related: Import Sets and Transform Maps overview · Table API · MID Server · Scheduled Jobs

For the topics covered in this guide, the most effective way to deepen your knowledge is hands-on practice on a Personal Developer Instance (PDI). ServiceNow provides free PDIs to all registered developers — request yours at developer.servicenow.com if you do not already have one. A PDI lets you experiment with configurations, break things safely, test edge cases, and build portfolio examples that you can demonstrate in interviews. Every senior ServiceNow practitioner has spent hundreds of hours on their PDI. It is the irreplaceable complement to reading guides like this one.

The weekly NowSpectrum newsletter delivers one focused, practical tip per week to your inbox — subscribe free at newsletter.nowspectrum.com. Each issue covers a specific pattern, common mistake, or practical technique relevant to working ServiceNow professionals. The archive covers every major platform area and makes for useful reference material when you encounter unfamiliar territory in a new project.

Large-volume import strategies

Importing large datasets — tens of thousands of rows — requires planning. Default Transform Map behaviour processes records synchronously in the foreground, which can cause timeouts on very large files. For files over 5,000-10,000 rows, enable background processing on the Import Set table to process the transformation asynchronously. Use the Import Set Worker feature to parallelize processing across multiple worker threads for very large imports. Monitor import progress via the Import Log and Import Set records — each row's outcome (inserted, updated, ignored, error) is recorded and queryable. The most common performance bottleneck in large imports is the Transform Map's onBefore script making a GlideRecord query for every row — replace these with cached lookups where possible, pre-loading lookup data into a JavaScript object before the loop rather than querying per row.

The ServiceNow platform rewards practitioners who invest in deep, systematic knowledge rather than surface-level familiarity with every feature. The guides in this series are designed to build that depth — covering not just the API surface but the underlying mechanics, the common mistakes, the performance implications, and the architectural patterns that experienced developers and admins have learned through production work. Use this guide as a starting point and return to it as your experience deepens — concepts that are abstract when you first read them often become clear once you have encountered the problem they solve in a real implementation. The NowSpectrum free weekly newsletter delivers one practical insight per week, and the product library at store.nowspectrum.com offers deeper reference materials including interview prep kits, API cheat sheets, and comprehensive guides for each major ServiceNow domain. Combined with hands-on

Import Sets in technical interviews

The Import Sets topic appears regularly in ServiceNow admin and developer interviews. Common questions: "What is the difference between an Import Set table and the target table?" (Import Set is a staging area — data lands there first, Transform Map moves it to the target). "What happens if the Transform Map coalesce field matches an existing record?" (The record is updated rather than inserted — coalesce is how you prevent duplicates on recurring imports). "How do you handle a row that fails transformation?" (Use the error and error_message variables in onBefore scripts to mark the row as failed without aborting the entire import). Know these cold. See also the comprehensive Import Sets guide.

Pass your ServiceNow interview

The NowSpectrum Interview Prep Kit covers 50 questions including Import Sets, CMDB, Update Sets, and admin fundamentals.

Get the Interview Prep Kit →
← Back to all posts