Updated on: August 1, 2025  |  0

Transform Maps & Data Import

CASE STUDY 1:📥 Import Sets and Transform Maps in ServiceNow

Learn how Import Sets and Transform Maps enable safe and efficient data loading from external sources into ServiceNow. This guide covers basic to advanced concepts, scripts, and real-world examples.

1️⃣ What are Import Sets?

Import Sets are temporary staging tables in ServiceNow that allow you to import data from external sources without directly affecting production data.

  • Safely bring external data into ServiceNow
  • Used for bulk data loading from external systems
  • Supports multiple data sources like CSV, Excel, JDBC, LDAP, or REST APIs

💡 Key Concept: Data lands in the Import Set Table first, then is transformed into target tables.

Key Components

  1. Import Set Table – Staging table created automatically (e.g., u_import_users).
  2. Data Source – Defines where the data comes from (CSV, database, REST API).
  3. Transform Map – Rules to move data from Import Set Table to target table.

Basic Example

Import an Employee CSV into sys_user table:

  • Full Name → name
  • Email → email
  • Department → department

2️⃣ What are Transform Maps?

Transform Maps define how to transform data from Import Set tables to target tables.

Key Features

  • Field Mapping – Source → Target field mapping
  • Coalesce – Prevents duplicates by checking key fields
  • Transform Scripts – Add custom logic to the transformation process

Transform Script Example (onBefore)


(function transformEntry(source, target, map, log, isUpdate) {
    // Auto-set asset status if missing
    if (!target.install_status) {
        target.install_status = 1; // Installed
    }
})(source, target, map, log, action==="update");
    

3️⃣ Advanced Concepts

  • Multi-Row Transform Maps – One source record creates multiple target records
  • Scripted Transform Maps – Full control using scripts instead of field mapping
  • Business Rules and Data Policies – Still apply during import
  • Transform Map Order – Multiple maps can run in sequence
  • Import Set API – Automate imports using GlideImportSetAPI

CASE STUDY 2:4️⃣ Real-World Examples

Example 1: HR Onboarding

  • Import Workday CSV into sys_user
  • Coalesce on email to update existing users
  • Use Transform Script to auto-assign departments

Example 2: CMDB Population

  • Import server inventory CSV into cmdb_ci_computer
  • Coalesce on serial_number to avoid duplicates
  • Auto-fill location based on department mapping

Example 3: Vendor Integration

  • Import vendor contacts via REST API
  • Use onAfter Script to send a welcome email

5️⃣ Best Practices

  • ✅ Always use Coalesce to prevent duplicates
  • ✅ Test imports in sub-production first
  • ✅ Use onStart and onComplete scripts for pre/post processing
  • ✅ Schedule imports for recurring data loads
  • ✅ Enable Transform History for auditing

🎬Conclusion

Import Sets and Transform Maps are the backbone of data migration in ServiceNow. They provide a safe, flexible, and scriptable way to bring external data into the platform.

Process Flow: Import Set → Transform Map → Target Table

By combining coalesce, scripting, and automation, you can achieve efficient and accurate data migration in ServiceNow. ✅

Comments

No comments yet.


Log in to post a comment