which one will run first CS OR UI Policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 12:49 AM
Hi Guys ,
In the service catalog which one will run first ui policy or client script ->
ans is dynamic actually :
depends on the client script type :
if its on change client script then UI policy will run first then on change client script.
if its on load then first on load client script will run first then UI policy.
Is the above ans correct ? what about other client script type is it same for them too
its very imp interview question.
please share the correct answer.
thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 01:05 AM - edited 11-04-2024 01:39 AM
Hi @tghadage124,
To answer your question directly, the execution order is Client Script first then UI Policy.
UI Policies are recommended for use for this very reason as they're the last to load/execute reflecting what you see on the form.
Please note, to scratch the surface a little, there is an order field on both Client Scripts and UI Polices which helps you to control the execution order between scripts and UI Policies, but the hierarchy is still maintained between the 2 - UI Policies are last to run.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 01:42 AM
Hi@tghadage124,
Here's the link to the ServiceNow developer site confirming my above statement: UI Policies execute after Client Scripts. If there is conflicting logic between a Client Script and a UI Policy, the UI Policy logic applies.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie