Professional Documents
Culture Documents
Blog
2) Now let us try to prove the fact that UI Policies are executed after the client
script.
So now let's conIgure the UI Policy as show below.
I am now setting "Description" Ield to "Non Mandatory" to test if result of client
script are applied in case 1 or result of this UI Policy is applied when form is
loaded
Once done, open any of the record form on "Database Instance".
You will notice two alert messages, Irst alert message comes from onLoad client
script which we built in step 1 and second message comes from UI Policy which
we built in this step.
Now let's try to Igure out what is happening
a) Our onLoad client script when gets Ired ahead of UI Policy, it tries to set
"Description" Ield as mandatory.
b) UI Policy when gets Ired after onLoad client script, it then tries to set
"Description" Ield as non mandatory.
4) Now, let's conIgure new UI Policy, lets make this UI Policy as conditional.
ConIgure the condition when operation status is "Non - Operational", this script
should Ire and set "Description" Ield is "Non Mandatory"
:
Now change the "Operational " to "Non Operational" and see what we get. You will
notice Irst our "onChange" client script gets Ired, and then our "Conditional UI
Policy" which we have conIgured in this step
:
This is also an expected result since UI Policy is Ired at the very last, so far so
good.
5) ConIgure onChange client script as per below screenshot. You will see there is
an "isLoading" property which we have used in this script.
sudarshanpuppala • 5y ago
S
Really good research and perfect explanation. Thank you for your great effort here.
could you please explain why client scripts get executed Irst?
$ Show comments
kshitij • 4y ago
K
manukundur • 4y ago
M
Very nice and detailed explaination. It really helps thanks for knowledge share.
$ Show comments
Pranshu • 3y ago
I have also found that if an onLoad client script uses GlideAjax the onLoad UI Policies will run
while the asynchronous Ajax response is coming back.
Well explained..
Were there any recent changes in San Diego to the order execution of any of these objects? we
can see different behavior in San Diego Instance vs Rome instance.
we have both UI Policy and client Script, but seems like after San Diego, their execution order
changed....
we are keep looking, but never hurts to double check.
:
Help
Terms of Use
Privacy Policy
Cookie Preferences
Trademark and Branding
ServiceNow Support
Knowledge Base