You are currently viewing ServiceNow Execution order of scripts and engines Questions 2024

ServiceNow Execution order of scripts and engines Questions 2024

Question: What is the significance of the execution order for scripts, rules, workflows, escalations, and engines in ServiceNow?

  • Answer: The execution order is important because it determines how and when various operations are applied to a database action, such as insert or update, ensuring correct and expected system behaviour.

Question: How does client-based code execution relate to form submission to the server in ServiceNow?

  • Answer: Client-based code that executes in the browser, using Ajax or running as JavaScript, will consistently execute before the form submission to the server.

Question: What is the execution order for scripts configured to run before a database operation?

  • Answer: Scripts configured to execute before the database operation with an order less than 1000 run first, followed by the execution of various engines, then scripts with an order greater than or equal to 1000.

Question: Name the engines that are executed before the database operation.

  • Answer: The engines executed before the database operation include the Approval engine, Assignment rules engine, Data policy engine, Escalation engine, Field normalization engine, Role engine, Execution plan engine, Update version engine, Data lookup engine, and Workflow engine (for default workflows).

Question: At which stage does the database operation occur in the execution order?

  • Answer: The database operation (insert, update, delete) occurs after executing scripts and engines configured to run before the operation.

Question: What happens immediately after the database operation regarding script execution?

  • Answer: Immediately after the database operation, scripts configured to execute after the database operation with an order less than 1000 are run.

Question: Which engines are executed after the database operation?

  • Answer: The engines executed after the database operation include the Label engine, Listener engine, Table notifications engine, Role engine, Text indexing engine, Update sync engine, Workflow engine (for deferred workflows), and Trigger engine (for all Flow Designer flows).

Question: How are email notifications triggered in the execution order?

  • Answer: Email notifications are executed based on the weight of the notification record, which includes notifications sent on an insert, update, or delete and event-based notifications.

Question: Describe the role of the Role engine in the execution order.

  • Answer: The Role engine keeps role changes in sync with the sys_user_has_role table, operating both before and after the database operation to ensure consistency across sys_user, sys_user_group, sys_user_grmember, and sys_user_role tables.

Question: What is the final stage of script execution in the order provided?

  • Answer: The final stage of script execution involves scripts configured to execute after the database operation with an order greater than or equal to 1000 after all other engines and notifications have been processed.

Leave a Reply