- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 10:33 AM
Hi,
Can anyone help me in very basic terms in what scenarios we will be removing these ones on Client Script? Kindly help.
Regards
Suman P.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 10:43 AM
This If statement in onChange client script checks if form is loading or the newValue is empty. In both the cases it returns and does not execute the further lines in the code.
Ideally the if statement should be part of every onChange client script. However, it can be removed in following scenario.
1. isLoading check can be removed if you want to trigger onChange client script even when the form is loading
2. newValue==='' check can be removed when you want to trigger the onChange script for empty values.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 10:43 AM
This If statement in onChange client script checks if form is loading or the newValue is empty. In both the cases it returns and does not execute the further lines in the code.
Ideally the if statement should be part of every onChange client script. However, it can be removed in following scenario.
1. isLoading check can be removed if you want to trigger onChange client script even when the form is loading
2. newValue==='' check can be removed when you want to trigger the onChange script for empty values.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 10:46 AM
control The field (UI element) that triggered the script (not commonly used).
oldValue The previous value before the field was changed.
newValue The updated value after the field was changed.
isLoading is true if the script runs when the form loads (prevents unnecessary execution).
isTemplate true if a record producer or template is applying values to the form.
Example 1: Prevent Execution on Form Load
Use Case: Stops script execution when the form loads.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) { // Prevents running when the form loads
return;
}
g_form.addInfoMessage("Field changed from " + oldValue + " to " + newValue);
}
Example 2: Check If a Field Value Was Cleared
Use Case: Ensures the script only runs when a new value is entered (not when cleared).
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.addInfoMessage("Field updated!");
}
Example 3: Restrict Execution for Record Producer Templates
Use Case: Ensures the script only runs when a user manually changes a field, not when a template auto-fills.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || isTemplate) { // Prevents execution for form templates
return;
}
g_form.addInfoMessage("Manual field update detected.");
}
Please Mark it helpful
Regards
Priyatam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 10:54 AM
Hi @Sandeep Rajput,
For NewValue=='', we can remove it when we are comparing with None? If we want to compare or validate the 'None' from the selectBox? Please confirm.
Regards
Suman P.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 06:00 PM
@Dave_p Yes in order to check 'None' you need to remove NewValue==''.