Prevent onChange Script Triggered by onLoad Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2025 03:23 AM
Hi Experts,
I have an onChange client script called "Date Validation" that runs whenever the "Extension Plan" field is changed. This script clears the Travel Start Date and Travel End Date.
I also have an onLoad client script that sets the "Extension Plan" field based on a certain condition.
The issue is: when the onLoad script sets the Extension Plan, it also triggers the onChange script, which I don’t want to happen in this case.
Is there a way to prevent the onChange script from running when the field is updated by the onLoad script?
Any suggestions to handle this scenario would be appreciated.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2025 03:27 AM
Hi @Sruthi17 ,
add this line in onchange client script like below (put it on top)
if (isLoading) {
return;
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2025 03:49 AM
If your onChange client script has isLoading check then it should not be triggered.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2025 04:31 AM
Hi @Sruthi17
Can you check the "IsLoading" in onChange client script.
If my response helped, please mark it correct.
Regards
Syed K