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.

Transform Map order

Pradnya6
Giga Contributor

How does the transform map order works?
I have 2 transform maps "Test 1" with order 100 and "Test 2" with order 200 are for a web service "Test Service".
In both the Transform maps I have added onBefore script with a log statement
1. "Test 1" transform map onBefore has log entry "Transforming Test 1"
2. "Test 2" transform map onBefore has log entry "Transforming Test 2"

After execution the log entries shows
"Transforming Test 1" with latest time stamp and "Transforming Test 2" with before "Transforming Test 1".

I assume the transform map order is to execute transform map in ascending order, here as per our example the "Test 1" has transform map order 100 so it will get execute 1st and then "Test 2".

Please let us know what is the correct order here to execute the transform maps in some sequence?

4 REPLIES 4

harshchhajer
Kilo Explorer

the ordering means in which order you want to run your script.
let test1 order is 100
and test2 order is 101
than test1 with order 100 will run first and than test2 with order101


ok ... but looks like it is running test2 first and then test1.


andrewmaryville
Kilo Contributor

The log often shows things in the wrong order. These events are happening in the correct order but such a small amount of time passes between the writes to the log, the log entries don't show up in the logical order. I'm not sure if it is due to threads or the way data is flushed or if it is just the fact you can only sort with the resolution of seconds, but if you have events that take long enough between them (on the scale of seconds) things show up in the log in the order you would expect.


Matt Hernandez
Tera Guru

Yes its difficult when you're troubleshooting and everything in the log occurs in the same second! When I'm doing my own inspections of issues I'll often run "background scripts" so that I can produce specific debug messages, and I've sometimes taken to appending my debug messages into a variable, then dumping that variable to log when the script finishes, so that my messages appear in one entry, in the order they occurred.



But that sometimes fails, if the code you're analyzing crashes the script somehow and never makes it to the end. So I later started adding a debug-message function into the code, with a persistent "count" variable, and passing the message to it when I want to log a debug message. This way its written to the log with an incrementing number, and I can export the log entries to Excel and sort them by the number.