Execution order of scripts
Scripts in the ServiceNow platform are executed in the following order:
- Before business rules: Business rule scripts, with an order less than 1,000, configured to execute before the database operation
- Before engines: Workflow, approval, and other engines
- Before business rules: Scripts configured to execute before the database operation but with an order greater than or equal to 1,000
- Database operation: Insert, update, delete, or query operation
- After business rules: Scripts with an order less than 1,000 configured to execute after the database operation
- After engines: Text indexing and workflow engines (for deferred workflows)
- E-mail notifications: Notifications sent on an insert, update, or delete and event-based notification executed based on the order
- After business rules: Any scripts with an order greater than or equal to 1,000 and configured to execute after the database operation