Which rule execute first client Scripts or UI polices?

ram2497
Tera Contributor

Which rule execute first client Scripts  or  UI  polices?

1 ACCEPTED SOLUTION

haseena ayesha
Kilo Guru

Hi

Ram2497

 

UI Policies execute after Client Scripts. If there is conflicting logic between a Client Script and a UI Policy, the UI Policy logic applies.

Client-based code:

"Client-based code that executes in the browser, using Ajax or running as Javascript, always executes before the form submission to the server."

This includes Client scripts and UI Policies.

First onLoad Client scripts, after that the first UI Policies kick in.

After that, the Client scripts and UI Policies that work onChange.

After that, the Client scripts that work onSubmit.

Refer the below link may helpful  you.

https://community.servicenow.com/community?id=community_blog&sys_id=512d26e5dbd0dbc01dcaf3231f9619ce

https://developer.servicenow.com/app.do#!/training/article/app_store_learnv2_scripting_jakarta_clien...

 

 

Thanks & Regards

Haseena

                                         

                                                             PS: Hit like, Helpful or Correct depending on the impact of the response  

                                         

View solution in original post

5 REPLIES 5

haseena ayesha
Kilo Guru

Hi

Ram2497

 

UI Policies execute after Client Scripts. If there is conflicting logic between a Client Script and a UI Policy, the UI Policy logic applies.

Client-based code:

"Client-based code that executes in the browser, using Ajax or running as Javascript, always executes before the form submission to the server."

This includes Client scripts and UI Policies.

First onLoad Client scripts, after that the first UI Policies kick in.

After that, the Client scripts and UI Policies that work onChange.

After that, the Client scripts that work onSubmit.

Refer the below link may helpful  you.

https://community.servicenow.com/community?id=community_blog&sys_id=512d26e5dbd0dbc01dcaf3231f9619ce

https://developer.servicenow.com/app.do#!/training/article/app_store_learnv2_scripting_jakarta_clien...

 

 

Thanks & Regards

Haseena

                                         

                                                             PS: Hit like, Helpful or Correct depending on the impact of the response  

                                         

Devyani_6
Mega Guru

Hi Ram,

First Client script runs then UI policies runs.

Reply again if need further help.

Hit Correct/Helpful, if this helps you.

Warm Regards,

Devyani

|www.DxSherpa.com|

Yash Agrawal1
Tera Guru

This is totally depends on ''Order no" which you specify. .....

Runjay Patel
Giga Sage

Check out this video, it will clear all your doubts and help you to understand Client Script queries in details.

Link: https://www.youtube.com/watch?v=Wj8ZAWtTBqo&ab_channel=ServiceNowHelpdesk

It help you to understand below points.

  • UI policy and Client script
  • why client script run first in service now?.
  • Which rule execute first client Scripts or UI polices?
  • g_user and g_form tips
  • Difference between client script and script include (server).
  • Scenario based implementation
  • Understanding below
    • onLoad()
    • onChange()
    • onSubmit()
    • onCellEdit()

 

Please mark reply as Helpful/Correct, if applicable. Thanks!!