Client Script

Rooma1
Tera Contributor

Hi All,

 

Which client script will run first- onCellEdit or onChange/onSubmit/onLoad client script if the script has been written on the same field?

This question was asked in an interview. Can anyone can tell me?

 

Thanks,

Rooma

4 REPLIES 4

Maddysunil
Kilo Sage

@Rooma1 

please check the below link 

 

https://www.servicenow.com/community/developer-forum/onload-onchange-onsubmit-onell-edit-client-scri... 

 

Kindly mark helpful/accepted if it helps you.

Thanks

Amit Pandey
Kilo Sage

Hi @Rooma1 

 

Please note that OnCellEdit() executes on list view only.

 

The execution order of client scripts on form are as follows -

 

1. onLoad()- When the form is loaded.

2. onChange()- When any change on the form is made.

3. onSubmit()- When a form is saved or submitted.

 

Please mark my answer helpful and correct.

 

Regards,

Amit

 

Aman Kumar S
Kilo Patron

Hi @Rooma1

The three types of client scripts, onLoad, onChange, onSubmit runs on the forms, that is loading,change and submission on forms sequentially.

onCellEdit only works in the list layout.

Whenever the form loads onLoad executes first, then onCHange, and once the form is submiited then the onSubmit.

 

Best Regards
Aman Kumar

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Rooma1 

 

Oncell edit for List view. 

onchange --> if you are changing any value on form level 

onsubmit --> when you submit the record. 

onload -- as soon form get loaded. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************