- 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 09:02 PM
Hi,
A transform map script executes as events occur while an import set is being transformed onto a ServiceNow table. Transform Map scripting is fully integrated into the ServiceNow scripting environment. There are two types of Transform Map scripts:
- Explicit Transform Map scripts, which explicitly define mapping relationships
- Transformation Event scripts, which modify the processing of events at different stages of a transformation
1.Explicit Transform Map scripts
An explicit Transform Map script explicitly defines mapping relationships in the Transform Map record itself. It runs after the source field values have been copied over to the target record, and before they are written to the database.
2.Transformation Event scripts These events modify the transformation behavior from any type of mapping specification. Transformation Event scripts modify the processing of the events at various stages of the transformation. For example, the processing of a mapping operation defined using the Mapping Assist Utility can be manipulated using the event scripts. There are a number of import set JavaScript objects that are accessible during these events. These objects represent tables or portions of tables. onStart When: The onComplete event script is processed at the end of an import run, after all data rows are read and transformedonComplete
When: The onComplete event script is processed at the end of an import run, after all data rows are read and transformed.
When: The onBefore event script is processed at the start of a row transformation, before the source row is transformed into the target row.
When: The onAfter event script is processed at the end of a row transformation, after the source row has been transformed into the target row and saved.
When: The onForeignInsert event script is processed at the start of the creation of a related, referenced record, before the record is created.
When: The onChoiceCreate event script is processed at the start of a choice value creation, before the new choice value is created.
When: The onReject event script is processed during the occurrence of a foreign record or choice creation, and the foreign record or choice is rejected ,the entire transformation row is not saved.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 09:10 PM
Hi Payal,
What you want to set in Type field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 09:45 PM
We had two tables with same fields so we merged them to one.. so for that we have two transform maps on same table. one transform map set Type to Ticket and other set Type to Task. and right now Coalense is on Date field which is converted to String type.
But the issue is when Ticket file transforms data with same date it is updating the Type, so we want coalense on Type field, but we dont want to change the File Template by adding Type in it.
Ex: If table is having 'Ticket' record with 31 Dec 2019 date. and If in file I insert 'Task' record for the same date , after transforming it, existing 'Ticket' record updated as 'Task' but I want to create both the records

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2019 10:00 PM
Hi Payal,
By removing coalesce of date field it will allow you to create both records.
Mark the comment as a correct answer and helpful if this helps.