Import & transform scripts
Quick answer
When you load data with import sets and transform maps, transform scripts are the code hooks that let you clean, enrich and control each row as it is written to the target table. They turn a dumb column-to-column map into a smart, defensible data pipeline.
Key takeaways
- The transform events
- An onBefore script
- Coalesce and field maps
- Try it Yourself
When you load data with import sets and transform maps, transform scripts are the code hooks that let you clean, enrich and control each row as it is written to the target table. They turn a dumb column-to-column map into a smart, defensible data pipeline.
The transform events
An onBefore script
source is the import-set row, target is the record being written. Set ignore = true in onBefore to skip a row, and use error = true with a log message to reject bad data instead of silently corrupting the target table.Coalesce and field maps
A coalesce field decides insert-vs-update (match found = update). Prefer field maps and coalesce for the simple stuff; reserve scripts for transformations the mapping UI can't express.
Want to learn this properly?
Our live, instructor-led ServiceNow Training covers this hands-on, with real projects and a certification path.
Check your understanding
To skip a row during transform you set...
- A. ignore = true
- B. current.update()
- C. abort = 1
Show answer
A. ignore = true
Setting ignore = true in onBefore skips writing that row.
Which event runs once before any rows?
- A. onStart
- B. onAfter
- C. onComplete
Show answer
A. onStart
onStart runs a single time before processing rows.
What decides insert vs update?
- A. The coalesce field
- B. The primary key only
- C. Row order
Show answer
A. The coalesce field
A coalesce match updates; no match inserts.