ITSM

CherukuA
Tera Contributor

importance of order number in ui policy

6 REPLIES 6

Zach Koch
Giga Sage
Giga Sage

The order number in the UI policy is the order it will run. The lower the number the earlier it will run in comparison to other UI policies on the table. For example
UI policy A has an order of 100 and HIDES field A

UI policy B has an order of 200 and SHOWS field A

Those are conflicting UI Policies, so the form would load, UI Policy A would run first since it has the lower order number, so it would HIDE field A, but then UI Policy B would run second as it has the higher order number, and would SHOW field A. So in this case field A would always be shown. If you reversed these orders, then Field A would always be HIDDEN as UI Policy A would run last.

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

Harish Bainsla
Tera Sage
Tera Sage

Hi @CherukuA 

UI Policies execute in the other indicated by the Order field, starting with one. The higher the value, the later it executes. This also means that a higher value in the Order field means that the policy will take priority over others with a lower Order value

for more knowledge check below links

https://www.servicenow.com/community/developer-forum/best-practices-for-ui-policies/m-p/2838124#:~:t....

https://www.servicenow.com/community/developer-forum/what-is-order-of-execution-of-ui-policy-weather...

if my answer helps you mark helpful and accept solution

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @CherukuA 

Not only in UI policies, ServiceNow executes other things like Client scripts, Business Rule etc in ascending order.

The lower value first, till the higher value it executes.

Please refer below doc:

https://www.servicenow.com/community/developer-forum/what-is-order-of-execution-of-ui-policy-weather...

 

Please mark the answer as helpful and correct if helped.

Kind regards,

Ravi Chandra 

Aniket Chavan
Tera Sage
Tera Sage

Hello @CherukuA ,

 

The order number in a UI Policy defines the sequence in which policies are executed. Lower numbers execute first, and higher numbers follow. This becomes crucial when multiple policies affect the same field, as the last executed policy takes precedence.

 

For example, if one policy with a lower order hides a field and another with a higher order shows it, the field will end up being visible. To avoid conflicts or unexpected behavior, always review the order and test the interaction of policies thoroughly.

 

A clear order ensures predictable outcomes, especially in forms with complex logic.

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.


Regards,
Aniket