How to transfer data across transform scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2024 10:51 PM
I need to transfer data from onBefore transform script to onComplete transform script .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2024 11:29 PM
You can by using this keyword.
Refer to below article to achive the same:
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2025 05:03 AM
I've submitted Introduce an Official Scratchpad Object for Import Set Transform Scripts to the Idea Portal. Please upvote it if you would like to see an officially supported method!
I have found no supported means to do this. 'current.scratchpad' and 'map.scratchpad' do not exist within transform scripts in any instance I have access to.
However, you can declare a variable in the global scope of an onStart script, which subsequent transform and field map scripts can reference.
Example onStart script:
// Global scratchpad (unofficial approach for sharing across scripts) var scratchpad = {}; (function runTransformScript(source, map, log, target /*undefined onStart*/ ) { // Add your code here scratchpad.test = "Does this work?"; gs.info(map.name + ' onStart: scratchpad.test = "' + scratchpad.test + '"'); })(source, map, log, target); |
To confirm it works, add this snippet to any field map or transform script:
gs.info(map.name + ' {script identifier}: scratchpad.test = "' + scratchpad.test + '"'); |
Caveat: This technique is not officially supported. It may break if ServiceNow changes how Import Set processing works. If you’d prefer a robust, documented approach, please consider upvoting the Idea Portal submission at the link above.