onLoad onChange onSubmit Onell edit client script exextion order?

Sandip Ghodke1
Tera Contributor

Suppose I applied onLoad onChange onSubmit Onell edit client script on a same form, what's is execution order of this. Which script will execute first.

2 REPLIES 2

Sagar Pagar
Tera Patron

Hi @Sandip Ghodke1,

The execution order on form as follows -

onLoad()

onChange()

onSubmit()

 

OnCellEdit() willl work on list view only.

 

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

All the three scripts have a different execution trigger. There is no real execution order.

 

let me explain you by example:-

 

1) When you open any new record and i.e when the form loads only the onLoad client script will run. Onchange can run if there is any field being set from onload and Onsubmit will not run.

 

So in this case:- 1) Onload 2) Onchange. Onsubmit cannot run in this scenario

 

2) When you change any field on the form then the onchange client script runs and onload and on submit will not run.

 

So in this case:- Onchange will only run . OnLoad and Onsubmit cannot run.

 

3) When a form is saved or submitted. Onsubmit and then onload and then onchange

 

So in this case:- 1) Onsubmit 2) Onload 3) Onchange

 

Now for cell edit client script it only works on list view and not on form view so this type cannot be compared with the above examples.

 

Please mark my answer as correct based on Impact.