- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
If you've worked on a ServiceNow implementation, chances are you've come across a situation where someone hands you an Excel file with hundreds or thousands of records and asks you to import them into ServiceNow.
And obviously, nobody wants to sit there creating records one by one. That's where Import Sets come in!
Import Sets are one of the most commonly used features in ServiceNow, especially when working with data migration, integrations and bulk data operations. But there's more to them than simply uploading an Excel file.
Let's understand how they work with a practical example.
What are Import Sets?
Think of Import Sets as a temporary landing area for incoming data.
Instead of directly inserting external data into your actual ServiceNow tables, the platform first loads it into an intermediate table called an Import Set Table.
Once the data is loaded, you can validate it, transform it and move it into the required target table.
For example, imagine your HR team sends you an Excel file containing 5,000 employee records. Your requirement is to import these employees into the ServiceNow User table.
The process looks like this:
Excel File → Data Source → Import Set Table → Transform Map → Target Table
That's essentially how Import Sets work.
Understanding Data Sources
Before importing data, ServiceNow needs to know where the data is coming from. That's what Data Sources are used for.
A Data Source defines the source of the incoming data. It could be an Excel file, CSV, XML, JDBC connection or another supported source.
For our employee example, we can create a Data Source and upload the Excel file containing employee details.
Navigate to:
System Import Sets → Load Data
Upload your file, select the appropriate file format and load the data.
ServiceNow creates an Import Set Table and loads the incoming records into it.
At this point, your data is available in ServiceNow, but it hasn't reached the actual User table yet.
That's where things get interesting.
Transform Maps – Where the Actual Mapping Happens
Imagine your Excel file contains the following columns:
| Employee ID | Employee Name | |
|---|---|---|
| 1001 | John | john@test.com |
| 1002 | David | david@test.com |
| 1003 | Sarah | sarah@test.com |
Your target table is sys_user.
But how does ServiceNow know that Employee Name should map to Name, or Email should map to Email?
This is where Transform Maps come into the picture.
A Transform Map defines how fields from the Import Set Table should be mapped to fields in the target table.
You can create a Transform Map by navigating to:
System Import Sets → Create Transform Map
Select your source table and target table, and configure the required field mappings using Field Maps.
Once configured, ServiceNow knows exactly where the incoming data belongs.
Coalesce – Avoiding Duplicate Records
Now, let's consider a real-world scenario.
You import 1,000 employee records today. Tomorrow, HR sends another Excel file containing the same employees, but 50 of them have updated email addresses.
What happens if you import the file again?
Without proper configuration, you could end up creating duplicate records.
Nobody wants that!
This is exactly why we have Coalesce.
Coalesce tells ServiceNow how to identify whether an incoming record already exists in the target table.
For example, you can configure Employee ID as the coalesce field.
When the next import happens:
-
If Employee ID already exists, ServiceNow updates the existing record.
-
If Employee ID doesn't exist, ServiceNow inserts a new record.
Simple!
One important thing to remember: always choose a field that uniquely identifies your records. Employee ID is generally a better choice than Employee Name.
Transform Scripts – When You Need More Control
Field mapping and coalesce handle many common scenarios, but real-world data isn't always straightforward.
Sometimes you need additional logic while importing records.
For example:
-
Skip inactive employees.
-
Validate incoming values.
-
Populate fields dynamically.
-
Perform additional transformations.
-
Handle specific conditions before inserting records.
That's where Transform Scripts help.
ServiceNow provides different transform script events, including:
-
onStart: Executes before the import rows are processed.
-
onBefore: Executes before an individual row is transformed.
-
onAfter: Executes after an individual row has been transformed.
-
onComplete: Executes after the entire transformation is completed.
-
onForeignInsert: Executes when a referenced record needs to be inserted.
Let's take a simple example.
Suppose HR sends employee records with an Active/Inactive status, and you don't want to import inactive employees.
You can write an onBefore Transform Script:
if (source.u_status == 'Inactive') {
ignore = true;
}
That's it! ServiceNow skips that particular row.
This is a simple example of how Transform Scripts give you more control over the import process.
What About Reference Fields?
This is another area where developers commonly run into issues.
Let's say your employee Excel file contains a Manager column.
| Employee | Manager |
|---|---|
| John | David |
| Sarah | David |
In ServiceNow, the Manager field on the User table is a reference field pointing to another user record.
You cannot simply assume that passing the manager's name will always populate the correct reference.
ServiceNow needs to identify the actual referenced record.
You can configure the reference field mapping using the appropriate referenced value field, such as user_name, depending on what value your source contains.
This becomes particularly important when importing data involving users, departments, companies, locations and other reference fields.
Common Mistakes to Avoid
A few things worth remembering when working with Import Sets:
-
Ignoring Coalesce: This can result in duplicate records when the same data is imported multiple times.
-
Incorrect Field Mapping: Always verify that source fields are mapped to the correct target fields.
-
Reference Field Issues: Make sure incoming reference values can be resolved correctly.
-
Not Validating Source Data: Empty values, incorrect formats and unexpected data can cause problems.
-
Overusing Transform Scripts: Before writing custom scripts, check whether OOB field mapping can solve the requirement.
-
Ignoring Performance: Be careful with large imports and unnecessary database queries inside transform scripts.
Conclution:
Import Sets might look like a simple data-loading feature, but they play an important role in ServiceNow implementations.
Whether you're migrating employee records, importing configuration items, integrating external applications or performing bulk data updates, understanding Data Sources, Import Set Tables, Transform Maps, Coalesce and Transform Scripts will help you handle these requirements confidently.
My suggestion? Don't just read about Import Sets. Pick an Excel file, create a Data Source, build a Transform Map and experiment with Coalesce and Transform Scripts.
You'll understand the concept much better when you actually see the records getting inserted and updated.
And remember, the goal is to make ServiceNow do the repetitive work, not to become the person manually entering 5,000 records!
Happy Learning, and Happy Scripting! 😄
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.