execution order
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Execution Order of client side and server side scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @sanketkhot7
Could you please clarify which specific scenario you’re referring to, such as form loading, field changes, or record submission? This will help me provide a more accurate answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
hi @sanketkhot7 ,
In ServiceNow, the execution order depends on the type of client-side and server-side script.
Client-side execution:
-
UI Policy – onLoad actions
-
Client Script – onLoad
-
Client-side scripts run when the user interacts with the form, such as onChange and onSubmit.
Server-side execution when submitting a form:
-
Before Business Rules
-
Data is saved to the database
-
After Business Rules
-
Async Business Rules run asynchronously
-
Display Business Rules run when the form is loaded, to send server-side data to the client.
Note that this is a simplified overview. UI Policies and Client Scripts can have different execution orders depending on their configuration, and Display Business Rules run before the form is rendered, not after the record is saved.
check attached screenshorts.
If this helped, mark it helpful and accept the solution.
Regards,
Tejas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @sanketkhot7
First Refer Servicenow Documentation : Execution order of scripts and engines
Also check community article: Servicenow 101 : Business rule, workflow and flow designer execution order.
For Client script -
In ServiceNow, Client Scripts execute first before UI policy but if a Client Script and a UI Policy apply conflicting logic to the same field (e.g., the Client Script makes a field read-only or hidden, and the UI Policy makes it editable or visible), the UI Policy wins and overrides the Client Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @sanketkhot7 ,
Component Type | Runs On | Order Rule | Conflict Resolution |
Client Scripts | Browser (Client Side) | Client Scripts and UI Policies execute according to their respective event and execution logic; there is no universal rule that Client Scripts always run first. | If both modify the same field, the final result depends on execution order and logic. UI Policies do not automatically take precedence over Client Scripts. |
Business Rules | Server | Determined by the Order field and execution type (Before, After, Async, or Display). | For Business Rules in the same execution phase, lower order numbers generally execute before higher order numbers (e.g., 100 before 200). Conflicts depend on the scripts and their execution phases. |
Also Refer this :
If my response helped mark as helpful and accept the solution.