We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Sequence of transform scripts?

Ravish Shetty
Tera Guru

What are the different sequence of transform scripts?

I am interested in

  • Big transform map script
  • Source script in Field map
  • Other transform scripts like on before, on after, etc
1 ACCEPTED SOLUTION

bernyalvarado
Mega Sage

Hi Ravio,



Here goes the order on which I believe it executes:



a) onStart


b) onBefore


c) Transform Map Script (right before the update takes place)


d) Fields Mapped Transforms


e) onAfter


f) onComplete



Thanks,


Berny


View solution in original post

23 REPLIES 23

I think what Scott is asking is more like at what point would "before" or "after" business rules run.  Which is a good question.  Haven't actually tried it out myself, but I'm pretty sure "before" business rules would run following all the onBefore transform map scripts + main transform map script.  Because any of those can set ignore = true, and abort the update.

For the "after" business rules, question is do they run before or after the onAfter transform map scripts.  I'd guess they run before the onAfter transform map scripts, but I would need to do some testing/logging to verify that.

There's also the business of order being less or more than 1000 affecting when business rules run.  As described in this Docs page.  Which could potentially apply here, but it doesn't actually mention transform maps on that page so perhaps not.

Regards
Michael

Hi Michael, 

Thanks a lot for your response!

I completely agree with you on regards the "On Before" business rules. I believe you perfectly describe it.

On the "On After" business, I believe these run asynchronous of the onAfter transform maps scripts. In other words, similar as other elements on the link you shared... these will run on "no particular order" :). The reason why I believe this is the case is because once the transaction is committed at the DB each thread (the business rules ones and the transform map ones) will follow their respective flows without one being dependent of the other.

As you said... it will be great to try this out!

Please keep us posted if you do.

Thanks again for your response!

 

Thanks,

Berny 

Damini Sheth2
Giga Contributor

Hi Ravish, following are the correct sequence of transform map script :

1. onStart
2. on Before
3. Source Field script
4. Run script
5. onAfter
6. onComplete

Regards,

Damini Sheth

Ebow Yawson
Tera Contributor

I think there should be an update to this as it shows up in searches often. The current order as of Quebec patch 5:

1. onStart

2. onBefore

3. onChoiceCreate

4. onComplete

5. onForeignInsert

6. onReject

7. onStart