Transform Maps, Field Mapping & Coalescing
When you import external data into ServiceNow, loading the data into an import set table is only the beginning. The transformation of that data into actual records stored in your primary ServiceNow tables is where the real value lies.
The transformation of data from the source to the target table is performed using Transform Maps in ServiceNow, which serve as the connection between data imported into ServiceNow and the System Tables where that data will reside.
Transform Maps define how imported ServiceNow fields map to fields in the target table, ensuring data goes where it belongs. This is important whether you are bringing a user, incident, or configuration item into ServiceNow. Transform Maps ensure that data arrives in the correct table safely and efficiently.
What is a Transform Map in ServiceNow?
A Transform Map in ServiceNow shows the relationship between the data in the import set table (where the data will initially be stored) and the target Table (like the sys_user, incident, cmdb_ci).
In simple words, a Transform Map serves as the “translator” between the incoming data and ServiceNow’s structured database. So, it tells ServiceNow: “Take this field from the imported set and insert it into this field in the destination table.”
Each transform map specifies:
- The source (import set) table
- The target (destination) table
- How do individual fields align between the two
- Any scripts or conditions applied during transformation
Without a transform map, the data you import will remain stuck in the staging table and never move into the live environment.
Creating Transform Map
Creating a transform map is straightforward and can be done right from the Import Set module.
Steps to create a transform map in ServiceNow:
- Navigate to System Import Sets → Administration → Transform Maps.
- Click New.
- Fill in the following details:
- Name: A descriptive title for the map (e.g., Employee Data Transform Map).
- Source Table: The import set table that holds the raw data.
- Target Table: The ServiceNow table where data will be moved (e.g., sys_user or incident).
- Click Submit.
- Open your new record and click Auto Map Matching Fields to align fields with the same names automatically.
- Review and manually adjust mappings as needed.
- Click Transform to run the transformation.
When done correctly, the target table will reflect the new or updated records from your import set.
Fields Mapping
At the heart of every transform map are field mappings, the individual connections between import-set fields and target-table fields.
You can configure these manually or use the Auto Map Matching Fields option to save time.
Working with Coalesce
A key feature in mappings is Coalesce, which determines how ServiceNow identifies and updates existing records.
- If Coalesce is enabled on a field, ServiceNow uses that field’s value to check if a matching record already exists.
- If a match is found, the record is updated instead of creating a duplicate.
- If no match is found, a new record is created.
For example:
In the sys_user table, you might set email as the coalesce field to prevent duplicate user records.
Run Transform Map
Sometimes, data imports require logic beyond simple mapping. That’s where ServiceNow transform map scripts come in.
Scripts allow you to clean, validate, or modify data dynamically during the import process. They run at different stages of the transformation and can adjust how ServiceNow processes each record.
| Script Type | When It Runs | Purpose |
|---|---|---|
| onStart() | Before the transformation begins | Initialize variables or set up preconditions. |
| onBefore() | Before each record is processed | Validate or adjust data before it’s written to the target table. |
| onAfter() | After each record is processed | Trigger related actions (e.g., send notifications, update related tables). |
| onComplete() | After all records are processed | Clean up, summarize results, or trigger follow-up actions. |
Commonly used variables are:
- Ignore
- action=”insert”
- action=”update”
- target
- source
Example:
You could use an onBefore() script to ensure that all imported usernames are lowercase before inserting them into the sys_user table.
Scripts make transform maps much more powerful, allowing administrators to handle complex or conditional data imports with precision.
Types of Transform Maps
While ServiceNow doesn’t classify transform maps into hard categories, they can be understood based on their purpose and structure:
| Type | Description |
|---|---|
| One-to-One Mapping | Each import record maps directly to one target record. Common for standard imports. |
| Many-to-One Mapping | Multiple import records merge into a single target record (e.g., aggregating data). |
| One-to-Many Mapping | CA single import record creates multiple related records in different target tables. |
| Scripted Transform Map | Uses custom scripting logic to manipulate or validate data during import. |
This flexibility allows administrators to tailor transformation behavior to suit different data structures and business needs.
What’s Next?
The next topic focuses on understanding the process of scheduling and automating the data import sets for an efficient data transfer process.
Next Topic