Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to transfer data across transform scripts

Shreya Nagar Na
Tera Contributor

I need to transfer data from onBefore transform script to onComplete transform script .

6 REPLIES 6

Maddysunil
Kilo Sage

@Shreya Nagar Na 

you can use the scratchpad to store temporary data during the onBefore transform script and access it in the onComplete transform script.

onBefore Transform Script:

// Set some data in the scratchpad during onBefore script
var myData = "This is some data";
current.scratchpad.myData = myData;

 

onComplete Transform Script:

// Access the data stored in the scratchpad during onComplete script
var myData = source.scratchpad.myData;
if (myData) {
// Do something with myData in the onComplete script
target.myField = "Transformed: " + myData;
}

 

Please mark my response helpful/correct if it helps you..Thanks

getting undefined data.

@Shreya Nagar Na Please apply log on myData and check what are you getting in that on both scripts.Also can share your script.

Sohail Khilji
Kilo Patron

Hi @Shreya Nagar Na ,

 

There is nothing as such !

These are types of Transform scripts which executes during the process of data base operations,

 

See the below image to understand the time of execution of each scripts....

 
 

SohailKhilji_2-1707894224004.png

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect