Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

I'm not sure about is Loading of onChange Client Script.

Ereshkigal
Tera Contributor

Hi.

I'm learning because I'll be using onChange's Client Script for future development.

I have confirmed the official Learn and community about is Loading, but I do not understand enough to verbalize it.

Could you please tell me the following in an easy-to-understand manner?

  1. If it is isLoading in the conditional expression, it says that the process will end, but is it okay to recognize that if you update the field and load the form without releasing the cursor, the script will not be executed?
  2. What happens if I delete the if statement and return, and is it okay to delete them?

find_real_file.png

Thank you!

1 ACCEPTED SOLUTION

Gaurav Rotke1
Kilo Guru

Hi Ereshkigal,

There is a way in onChange client script that we can execute the onLoad client scipt as well. 

You can write onChange code in the block that says begin script below, and for on load code you can write that inside if block. This will execute onLoad and onChange codes in a one client script only. Script will execute on loading as well the after changing a specific field value which mentioned in onChange.

Its not best practice to remove isLoading but if you wanna see the result, you can try this in your PDI.

If it helps please mark helpful.

Thank you

Gaurav Rotke

View solution in original post

2 REPLIES 2

Gaurav Rotke1
Kilo Guru

Hi Ereshkigal,

There is a way in onChange client script that we can execute the onLoad client scipt as well. 

You can write onChange code in the block that says begin script below, and for on load code you can write that inside if block. This will execute onLoad and onChange codes in a one client script only. Script will execute on loading as well the after changing a specific field value which mentioned in onChange.

Its not best practice to remove isLoading but if you wanna see the result, you can try this in your PDI.

If it helps please mark helpful.

Thank you

Gaurav Rotke

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

the isLoading check simply tells you that the script can run on form load

There are use cases where we need to perform some scripting when form loads and then onChange should work

if you remove line 2,3,4 it's just that your client script would be purely onChange and you cannot use it for onLoad activities

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader