Options

Exploring TRANSFORM SCRIPTS IN SERVICENOW

Since there are such huge numbers of various choices for when to run a change content, it can be hard to figure out what will work best for your application. In this post, I'll go over the diverse sorts of contents and in addition the factors that are accessible to every one. ServiceNow has some documentation on the most proficient method to delineate change occasion contents that I utilized as a kind of perspective while I was playing around with change maps. I'll simply plunge somewhat more profound into those ideas in this post. The accompanying contents are recorded in the request that they execute in.

The accompanying contents are recorded in the request that they execute in:

z10ozcpwkboo.png

Below is a diagram of a sample import set. Each script will have another diagram that shows when they run.

ukfz3u06448k.png

ON START
Variables: source, import_set, map, log, ignore, error

Note: Only the variables listed above apply to the current script. A list of all the variables and how they work can be found at the bottom of the post.

mk96s0jduhfv.png

Summary: onStart runs at the very beginning of the import before any of the records are processed. None of the fields can be accessed on the source or target tables since they have not been set up yet. If you try to access fields in the onStart script, the transform will not run. If you wanted to inform a user that more records were being imported, you could use the onStart script to send out the message that the import has started.

ON BEFORE
Variables: source, target, import_set, map, log, action, ignore, status_message, error, error_message

dnirfh9ivnux.png

Summary: onBefore runs before every row is processed. This script runs for each individual record. If you want to set or alter values on the source table (see Temperature example explained in the Field Level Source Script section below) it can be done here. onBefore scripts can be used to verify that the value of a source field is valid. If the value is invalid, the script can take action.


Sign In or Register to comment.