---
title: Client Scripts should check for isLoading and return
description: "Impact Area Performance Severity Low Affected Element Client Script ## Rule ID SN-CHECK-ISLOADING-AND-RETURN ## Impact Without the isLoading check in onChange client scripts, the script will run every time the form loads, even when it’s not needed. This can lead…"
url: "https://community-staging.qualityclouds.com/qcdocs/qc/servicenow-rules/client-scripts-should-check-for-isloading-and-return/"
updated: "2025-03-21"
category: Rules for ServiceNow / ServiceNow Rules
---

# Client Scripts should check for isLoading and return

Impact Area

Performance

           Severity

Low

           Affected Element

Client Script

## Rule ID

SN-CHECK-ISLOADING-AND-RETURN

## Impact

 Without the isLoading check in onChange client scripts, the script will run every time the form loads, even when it’s not needed. This can lead to performance issues and slower form load times, especially if server calls are made during form load. In addition, scripts intended to respond to user actions may execute prematurely, leading to a confusing or inconsistent user experience.

## Remediation

 The isLoading flag is the simplest way to prevent unnecessary code from taking up browser time in onChange scripts. The isLoading flag should be used at the beginning of any script that is not required to run when the form is loading. Add “if (isLoading) return;” as the first statement of the onChange function.

**Time to fix**

5 min
