Robust Transform Maps

Jace Benson

Table of content
  1. How Field Mapping Works
  2. What a Transform Map Does
  3. Coalesce
  4. Field Map Scripts
  5. Further Reading

Docs

A Transform Map is the bridge between your import set staging table and the actual production table. It tells ServiceNow which staging columns map to which target fields, and what to do when things don't line up perfectly.

How Field Mapping Works

Each Transform Map has Field Maps — one per target field. A field map says "take the value from staging column X and put it in target field Y."

Example: If your CSV has a column Full Name and your sys_user table has name, you create a field map from Full Name → name.

What a Transform Map Does

Coalesce

Coalesce is the dedup mechanism. Mark a field as the coalesce field, and ServiceNow will look for an existing record with the same value in that target field. If found, it updates the record. If not found, it inserts a new one.

Common coalesce fields:

Field Map Scripts

You can write a script on any field map to transform the value:

// Example: Transform a phone number format
(function transformValue(source, target, value) {
    var cleaned = value.replace(/[^0-9]/g, '');
    return '(' + cleaned.substring(0,3) + ') ' + cleaned.substring(3,6) + '-' + cleaned.substring(6,10);
})(source, target, value);

Further Reading