Order of execution of business rules, ui policy, ui action and script action

amaneet
Kilo Contributor

Hi Folks,

May i know which gets order business rules, ui policy, ui action and script action run? wiki does not mention about ui action,ui policy and script action

Thanks

12 REPLIES 12

Swarup Patra
Kilo Guru

Sure, the order of execution in ServiceNow for business rules, UI policies, UI actions, and script actions is as follows:

1. UI Policies: UI Policies are client-side scripts that are executed on the user's browser. They are used to make changes to form fields when certain conditions are met. They are executed first when a form is loaded.

2. Client Scripts: Client Scripts are also client-side scripts that are executed on the user's browser. They are used for more complex form manipulations that cannot be achieved with UI Policies. They are executed after UI Policies.

3. Business Rules: Business Rules are server-side scripts that execute whenever a record is queried, displayed, updated, inserted, or deleted. They are executed when the form is submitted.

4. UI Actions: UI Actions are buttons, links, and context menu items on forms and lists, which can perform various actions. They are executed when the user clicks on the UI Action.

5. Script Actions: Script Actions are server-side scripts that execute when a specific system event occurs, such as an email being sent out. They are executed after the form is submitted and the record is updated.

Please note that the order of execution can vary depending on the specific configuration and customization of your ServiceNow instance.


nowKB.com

If you want to know any information about Service Now . Visit to https://nowkb.com/home

smitaD
Tera Contributor
Note: Client-based code that executes in the browser, using Ajax or running as JavaScript, will always execute before the form submission to the server.
The order of execution is as follows:
  1. Before business rules: Scripts configured to execute before the database operation with an order less than 1000.
  2. Before engines. The following are not executed in any specific order:
    • Approval engine (for task and sys_approval_approver tables)
    • Assignment rules engine (for task tables)
    • Data policy engine
    • Escalation engine
    • Field normalization engine
    • Role engine - keeps role changes in sync with sys_user_has_role table (for sys_user, sys_user_group, sys_user_grmember, and sys_user_role tables)
    • Execution plan engine (for task tables)
    • Update version engine - creates version entry when sys_update_xml entry is written (for sys_update_xml table)
    • Data lookup engine inserts or updates
    • Workflow engine (for default workflows)
  3. Before business rules: Scripts configured to execute before the database operation with an order greater than or equal to 1000.
  4. The data base operation (insert, update, delete).
  5. After business rules: Scripts configured to execute after the database operation with an order less than 1000.
  6. After engines. The following are not executed in any specific order:
    • Label engine
    • Listener engine
    • Table notifications engine
    • Role engine - keeps role changes in sync with sys_user_has_role table (for sys_user, sys_user_group, sys_user_grmember and sys_user_role tables)
    • Text indexing engine
    • Update sync engine
    • Workflow engine (for deferred workflows)
    • Trigger engine (for all Workflow Studio flows)
  7. Email notifications. The following are executed based on the weight of the notification record:
    • Notifications sent on an insert, update, or delete
    • Event-based notifications
  8. After business rules (Only active records). Scripts configured to execute after the database operation with an order greater than or equal to 1000.

KrishnaMohan
Giga Sage

Hi @amaneet 

Script execution Order in servicenow

 

MicrosoftTeams-image (2).png 

 

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Krishnamohan