7/6/22, 7:21 PM Data Source - ServiceNow Helpdesk
Contents [hide]
1 What you will learn from this module?
2 Preparing Data for Import
2.1 Data Sources
2.2 Data Import Process
2.3 Load Data
2.4 Create a Transform Map
2.5 Run a Transform Map
2.6 Transform Event Scripts
2.7 Objects are in Transform Script
What you will learn from this module?
Create a Data Source for importing records
Load data into a staging table
Create a Transform Field Map
Auto Map Matching Fields
Mapping Assist
Change or set field values using a Transform Map script
Coalesce to detect collisions
Use a Transform Event script to update but not insert records
Preparing Data for Import
Before importing data into ServiceNow, it is recommended you take the time to:
Understand what data you are bringing in
Decide what to do with incomplete or erroneous data
Create a plan to map the source file columns to the target table columns
Data Sources
Data sources define what data should be imported. Only admin users can create data
sources.
Data sources:
https://servicenowhelpdesk.com/data-source/ 1/7
7/6/22, 7:21 PM Data Source - ServiceNow Helpdesk
CSV
JDBC
FTP
HTTP
XML
Navigate to System Import Sets > Administration > Data Sources to create a new
data source record.
Data Import Process
Data is not imported directly from a Data Source into the target table. The steps are:
Load data into a staging table
Create a Transform Map
Run a Transform to move data from the staging table to the target table
Check the data integrity
https://servicenowhelpdesk.com/data-source/ 2/7
7/6/22, 7:21 PM Data Source - ServiceNow Helpdesk
Load Data
Navigate to System Import Set > Data Source and open the newly created data source.
Attached excel sheet and click on related link “Test Load 20 Record”
Create a Transform Map
A Transform Map matches the columns from the staging table to the columns in the target
table. Every import operation requires at least one transform.
Configure the Table Transform Map:
Navigate to System Import Set > Data Source and open the newly created data
source.
Go to related list named “Transform” and click on “New” button to create a new transform
map.
Click on Auto Map Matching Fields related link to auto map the fields or click on
Mapping Assist to manual field map.
Update coalesce filed to True for an attribute so that if system will look for the record based
on coalesce field value. It will update if find the match else create new record.
Run a Transform Map
Running a transform map imports data from the staging table into the target table. To run a
Transform Map, click the Transform Related Link in the Table Transform Map record.
https://servicenowhelpdesk.com/data-source/ 3/7
7/6/22, 7:21 PM Data Source - ServiceNow Helpdesk
In the Specify Import set and Transform map form, verify that the Transform Map to run is
in the selected maps, run in order slush bucket. Click the Transform button.
The Progress page shows the transform’s State and Completion code. A Completion
code value of Success does not mean the records imported correctly. The Completion
code indicates whether the transform executed successfully and is not indicative of the data
integrity of the records.
Click the Import log link to see if there were errors with the data. In the example, the
transform and import was successful.
https://servicenowhelpdesk.com/data-source/ 4/7
7/6/22, 7:21 PM Data Source - ServiceNow Helpdesk
Click on Transform History to see the state like how many got
inserted/updated/skipped/Ignored/Errors
Transform Event Scripts
Transformation events occur during the process of transforming an import set table onto a
target table. Transformation Event Scripts modify the transformation behavior at different
points in the transformation process.
To create a Transform Event Script, switch to the Transform Scripts related list in a
Transform Map and click the New button.
The When option in the Transform Script trigger specifies when in the transformation
process the script should run.
The When field choices are:
https://servicenowhelpdesk.com/data-source/ 5/7
7/6/22, 7:21 PM Data Source - ServiceNow Helpdesk
onStart: executes at the start of an import before any rows are read
onAfter: executes at the end of a row transformation and after the source row has
been transformed into the target row and saved
onBefore: executes at the start of a row transformation and before the row is
transformed into the target row
onChoiceCreate: executes at the start of a choice value creation before the new choice
value is created
onComplete: executes at the end of an import after all rows are read and transformed
onForeignInsert: executes at the start of the creation of a related, referenced record
before the record is created
onReject: executes during foreign record or choice creation if the foreign record or
choice is rejected. The entire transformation row is not saved.
When coalescing, the requirement might be to update only records that match and not
insert any new records. To meet the update records only requirement requires an onBefore
Transform Script. The onBefore script executes after ServiceNow has determined whether
there is a matching record in the target table and before the insert happens
The action string variable is automatically created. It has two possible
values: insert and update. The action variable is set after coalescing determines if there is a
match (update) or no match (insert).
The ignore Boolean variable is automatically created. When true, the ignore variable stops
the transformation process for the source data row.
Objects are in Transform Script
The row of the source table that is currently being
source GlideRecord
processed.
The row of the target table that is currently being
target GlideRecord
processed.
The import set that is currently being
import_set GlideRecord
transformed.
https://servicenowhelpdesk.com/data-source/ 6/7
7/6/22, 7:21 PM Data Source - ServiceNow Helpdesk
map GlideTransformMap Read-only information about the current
transform map record.
The log object for the current import run. For
log Function
example, log.info(…), log.warn(…), log.error(…).
Action returns a value of either “insert” or
action String “update” indicating whether the current target
row was created or updated.
Defines a custom message to be sent in the
status_message String
<status_message> XML response.
When set to true, will halt the entire
error Boolean transformation for the current import set, with an
error message.
Defines a custom message to be sent in the
error_message String
<error_message> XML response.
https://servicenowhelpdesk.com/data-source/ 7/7