Which one will runs first UI Policy action or UI Policy script

Arjun25
Tera Contributor

I believe UI Policy Scripts run first am i right????

28 REPLIES 28

Sanket Khabiya
Kilo Sage

By my observation UI Action runs first then the UI Script,

for eg,: try to add an field msg with bug(don't add semi colon or don't pass (true/false)), here you will find the UI Action runs as per the given condition and UI Script will not show you the field msg.

Hence UI Action still execute correctly even if UI Script fails.

Correct me if am wrong!

Suggestion will be appreciated!!

 

Regards,

Sanket

Okay it works as you say, but the execution order ??

 

Kelly Logan
Kilo Sage

This is an actual question on the Application Developer Certification exam, despite there not seeming to be any documentation about it. Has anyone found any documentation at all pointing to this? Or can we get an answer from ServiceNow?

Which runs first, a UI Policy Action or a UI Policy Script?

  1. Action runs first, then Script.
  2. Script runs first, then Action.
  3. Both run simultaneously.
  4. Order of execution is determine by the system at runtime.

I believe what @nimerkawwa says here is correct.  I did a little experiment in Quebec, setting a field to Mandatory in the Script portion of the UI Policy, and setting the same field to NOT Mandatory in a UI Action.  (There were no script Conditions.)  And the field ended up as Mandatory.  I believe that means that the Script Actions run first, and then the Script portion of the Policy Itself.  This is counter-intuitive, but it's what I'm seeing.

Steps:

Step 1.  UI Policy "When to Apply" Conditions are evaluated.

Step 2.  The various UI Policy Actions are executed if step 1 evaluated to true.  Or, if step 1 evaluated to false, and the "Reverse if false" checkbox is selected, the UI Policy Actions STILL get executed, but their behavior is reversed.

Step 3.  The "Execute if true" Script portion of the UI Policy is executed, if step 1 evaluated to true.  If step 1 evaluated to false, the "Execute if false" Script portion of the UI Policy is executed.

 

If anyone thinks that what I am saying here is wrong, please provide evidence / documentation to back up your claim.  Thank you.