
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2016 08:13 AM
Currently I am new to ServiceNow and I trying to understand from a conceptual level on the significance and purpose behind various scripting. Apart from the usual text book definition of onLoad and onChange scripts, how would we different the significance, purpose or usage between these two scripts?
Regards,
Gaurav Choudhury.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2016 08:15 AM
Hi Gaurav,
- onLoad means the Client Script runs when the form or page is loaded
- onChange means the Client Script runs when something specific gets changed AND also when the form or page loads
Additional parameter for onChange client script is : isLoading - identifies whether the form is loading and also indicates that no fields have changed value. This parameter can only be true when the form is loading and no values have changed.
http://wiki.servicenow.com/index.php?title=Client_Scripts

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2016 08:15 AM
Hi Gaurav,
- onLoad means the Client Script runs when the form or page is loaded
- onChange means the Client Script runs when something specific gets changed AND also when the form or page loads
Additional parameter for onChange client script is : isLoading - identifies whether the form is loading and also indicates that no fields have changed value. This parameter can only be true when the form is loading and no values have changed.
http://wiki.servicenow.com/index.php?title=Client_Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2021 02:22 AM
Why do we need onload client script when onchange can run on load? Execution of part of code can be controlled by isLoading.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2016 08:16 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2016 06:40 PM
Hey Gaurav,
Let me know if that answered your question. If so, please mark it as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list. Thank you