Script execution flow

General Add comments

About two years ago I followed the ServiceNow Scripting training. The training provides information about most common places were different types of scripts are located in ServiceNow. As more or less a beginner with ServiceNow at that moment, I heard a lot of different places where I can create or find scripts. Some of these scripts can be ordered with a number in which sequence they have to be executed, for example business rules.
Besides the ‘order’ field, which sorts the execution of the business rule, the type of the business rule is also relevant for the order of executing the multiple scripts. For business rules ServiceNow provides a basis image for which order business rules are executed:


In addition to business rules, we have client scripts with different types (e.g. onLoad, onChange and onSubmit) and we do know the onLoad and onChange UI policy. Not to forget, we also have Server side and client side UI actions, the workflows and data policies.
This was the moment in the training I realized that this amount of scripts must have a specific sequence in which way they are executed and that is what I asked the trainer. Because the trainer understood the added value to this question we had a brain breaking session with the whole class and finally figured out on a whiteboard what this sequence is in ServiceNow. Nowadays this has not changed. After the class I made a Visio drawing of it and shared it between multiple colleagues. Even today when I am debugging, I still use this drawing, because it is very valuable to know in which order all these scripts are executed. Moreover, when colleagues ask me for help I share this image with them. I hope that this will be also helpful for you. Please leave some comments if you have feedback!


One Response to “Script execution flow”

  1. Paul Says:

    Great Diagram!
    Just one thing I can see missing – deferred workflows that run on the conclusion of after business rules < 1000

Leave a Reply