Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • Madrid
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Execution order of scripts and engines

Log in to subscribe to topics and get notified when content changes.

Execution order of scripts and engines

Scripts, assignment rules, business rules, workflows, escalations, and engines all take effect in relation to a database operation, such as insert or update. In many cases, the order of these events is important.

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)
    • 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
    • Data lookup engine inserts or updates
    • Workflow engine (for deferred workflows)
  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. Scripts configured to execute after the database operation with an order greater than or equal to 1000.
Feedback