Client Script on Submit or Business Rule for after condition, which runs first?

suvro
Mega Sage
Mega Sage

Hi,

Client Script on Submit or Business Rule for after condition, which runs first?

I want to run the client script first?? Is it possible??

Thanks and Regards,

Chandra

4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Does this also apply to onSubmit Client scripts and g_scratchpad (which uses a display business rule?)

david_legrand
Kilo Sage

Hi Chandra, definitively the Client Script on submit



The client scripts are running on your browser while the business rules are running on the servers.


Meaning, when the client script is executed, it doesn't even know (or care) if a business rule onBefore or onAfter will be executed later



For the server side, this Execution order of scripts and engines   is useful.



When it make sense (meaning when someone is actually clicking on the records), the client side scripts would be executed after the "queries and the display business rules" but before the any step on this list.


Deepa Srivastav
Kilo Sage

You may find below link useful.


http://wiki.servicenow.com/index.php?title=Execution_Order_of_Scripts_and_Engines#gsc.tab=0



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



Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.


Thanks,
Deepa