Precedence between data lookup, assignment, and business rules
Summarize
Summary of Precedence between data lookup, assignment, and business rules
This document explains the precise order of execution for various scripts, rules, and engines in ServiceNow during database operations such as insert or update. Understanding this order is critical for effectively managing how data is processed and ensuring that business logic and automation behave as expected.
Show less
Order of Execution
ServiceNow processes client-side and server-side logic in a well-defined sequence during a database operation:
- Client-side code: Executes first in the browser before form submission to the server.
- Before business rules (order < 1000): Scripts configured to run before the database operation.
- Before engines: Several engines execute here but not in a specific order, including:
- Approval engine (for task and sysapprovalapprover tables)
- Assignment rules engine (for task tables)
- Escalation, data policy, field normalization, role, execution plan, update version, data lookup, and workflow engines
- Before business rules (order ≥ 1000): Additional scripts configured before the database operation.
- Database operation: Actual insert, update, or delete occurs.
- After business rules (order < 1000): Scripts configured to run after the database operation.
- After engines: Engines that execute post-operation, including label, listener, table notifications, role, text indexing, update sync, workflow (deferred), trigger, and email notifications engines.
- Email notifications: Sent based on the notification record’s weight and event type (insert, update, delete, or event-based).
- After business rules (order ≥ 1000): Additional scripts configured to run after the database operation.
- Async business rules: Execute asynchronously after form submission and after the scheduled job runs, allowing background processing without delaying user interaction.
Why This Matters to ServiceNow Customers
Knowing the exact sequence of data lookup, assignment, and business rules helps customers design and troubleshoot workflows, automate assignments, and implement business logic without unexpected conflicts or timing issues. This clarity enables more predictable system behavior and smoother data processing during transactions.
Related Concepts and Next Steps
- Explore the Assignment rules module, Data lookup rules, and Workflow assignments to configure automated task routing and data enrichment.
- Use related tasks like creating assignment rules or assignment data lookup rules to implement specific automation needs.
- Review baseline examples and related business rule documentation for best practices in rule configuration.
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.
- Before business rules: Scripts configured to execute before the database operation with an order less than 1000.
- 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)
- Escalation engine
- Data policy 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)
- Before business rules: Scripts configured to execute before the database operation with an order greater than or equal to 1000.
- The data base operation (insert, update, delete).
- After business rules: Scripts configured to execute after the database operation with an order less than 1000.
- 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)
- 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
- After business rules (Only active records). Scripts configured to execute after the database operation with an order greater than or equal to 1000.