Error Reference

Catalog client script error: script failed on catalog form

Catalog client script error: script failed on catalog form

Where this appears

This error appears in the browser console when a client script on a Service Catalog item form encounters a JavaScript runtime error. The error typically occurs during form loading, field value changes, or form submission when catalog variable interactions fail. Users may notice that catalog form behaviors like field visibility, mandatory settings, or value calculations stop working properly.

Sourdough
Chrome Extension

Debugging this in a real instance?

Sourdough lets you trace "Catalog client script error: script failed on catalog form" through system logs, script errors, and API health in the ServiceNow tab you are already using.

Add to Chrome

Free to install. Pro $5/month after a 14-day no-card trial.
Pro requires the ServiceNow admin role. Upgrade inside the extension.

Overview
Tasks
CMDB
API
Metrics
Monitor
Internals
Instance:sourdoughdev·Version:Yokohama
Instance StateONLINE
System StatusFully Operational
Session Timeout90 minutes
Logged-In Sessions2 (20 active)
Build Nameyokohama-12-18-2024_p1
IP Address10.159.128.43
Instance HealthHealth Score: 90%
🔥 5dSourdough (Chrome Plugin)Dark Mode

Cause

Using g_form.getValue() instead of g_form.getVariable() to access catalog variable values, which returns null for catalog variables and causes subsequent script failures. (high likelihood)

Attempting to access catalog variables or fields before they are fully loaded on the form, particularly in onChange scripts that execute during form initialization. (high likelihood)

JavaScript syntax errors in catalog client scripts such as missing semicolons, undefined variables, or incorrect function calls that prevent script execution. (medium likelihood)

Referencing catalog variables that have been deleted or renamed but are still referenced in existing client scripts, causing null reference errors. (medium likelihood)

Calling unsupported GlideForm API methods on catalog forms that are only available on regular form views, such as certain g_form methods specific to record forms. (low likelihood)

Fix

Step 1: Open the browser developer console (F12) and reproduce the error to view the complete JavaScript error stack trace and identify the specific failing script and line number.

Step 2: Navigate to Service Catalog > Catalog Definitions > Catalog Client Scripts and locate the failing script using the script name or line number from the console error.

Step 3: Review the script code and replace any instances of g_form.getValue() with g_form.getVariable() when accessing catalog variable values, as catalog variables require the specific getVariable method.

Step 4: Add null checks before accessing catalog variables by using if statements to verify the variable exists: if (g_form.getVariable('variable_name')) before performing operations on the variable.

Step 5: Verify that all referenced catalog variables exist in the catalog item by checking Service Catalog > Catalog Definitions > Catalog Items and reviewing the Variables related list.

Step 6: Test the catalog form in a new browser session or incognito window to ensure the client script executes without errors and catalog variable interactions work as expected.

Step 7: Check the Application Log at System Diagnostics > Log > Application Logs for any server-side errors that might be related to the catalog client script failure.

Step 8: If using onChange scripts, add a brief delay using setTimeout() or check if the form is fully loaded before accessing variables to prevent timing-related errors during form initialization.

Test Your Knowledge

Quick 3-question quiz. See how your ServiceNow skills stack up.

Question 1 of 3Performance

A list view on a table with millions of records is slow. Best fix?

Select an answer to continue