- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 08:41 PM
Hi All,
I want to know what is the difference between Script when checked "Run Script" true and "Transform Scripts" in Transform Map.
We have a one "Type" field which is not available in file, because template of that file is fixed, and we are setting that target table "Type" field value using run script's script.
Now the requirement is, we want that field to make that Type field to coalense true.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 10:50 PM
Hi Payal,
You don't need a field in your import file. But in your transform map, under field maps Tab, you can click on New and in that form, select use source script (checkbox).
Write the mapping code in there and save.
Then under field maps, you will see a new row for this field. For that row, select coalesce as True.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 10:02 PM
Hi Again,
If your table have such field which stores unique value then set coalesce on that field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 10:12 PM
We have 2 fields one is 'Date' with date type and other is 'Month' field in which a string field and copies value from date field as a string.I have set Month field as coalense . so it is updating a record, so for that I want to set Type as a coalense.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 10:18 PM
Then it will not update the record with same date.
Ex: table already have record for 31 dec 2019 and user insert new record for that date, new record will get created for the same date

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 11:01 PM
If you want to allow record of same date then coalesce should not be on date/month field(coalesce is only for those which you don't want to repeate).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 09:44 PM
Hello Payal,
Transform Scripts Or Transform Event Scripts
Transformation events occur during the process of transforming an import set table onto a target table. Transformation Scripts modify the transformation behavior at different points in the transformation process.
There are 6 Types of Transform script.
- 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.
For example, 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.
Run script:
Define a script that transforms field values in the source table to the target table.
Transform map script that transforms field values in the source table to the target table. The system runs the
transform map script in addition to any field maps.
Difference between them:
While using Transform script or transform event script, we can decide when we need to perform the script logic to update field for the record as we have 6 different script types.Where as, Run script will run at the time of transformation only. Once you clicked on transform button, it will start running.
For your case, You need to Use BEFORE transform script and add your code their, So before inserting/updating record into target table it will set the values.
Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade
Abhishek Gardade
Mark the comment as a correct answer and helpful if this helps.