Solving ServiceNow Errors: How to Correctly Call a Script Include from a Reference Qualifier
- ericpark68
- Mar 21
- 3 min read
Updated: Mar 26

When creating catalog items in ServiceNow, developers often use reference qualifiers to filter options displayed in a reference field based on another field's value. However, it's common to run into errors when these qualifiers attempt to call Script Includes. This article discusses the error "Script Include not being called from a reference qualifier," its common causes, and verified solutions.
Understanding the Problem: Script Include Call Failures
The error occurs when a reference qualifier is expected to trigger a Script Include, but it fails to execute, showing no log outputs or desired filtering behavior. For example, consider the following scenario: You have a catalog item with two fields, 'requested_for' and 'store_no'. The 'requested_for' field auto-populates with the current user's sys_id, and based on this value, the 'store_no' field should dynamically show the stores available to that specific user.
A common attempt to set this up might look like this:
javascript : new x_infte_esm_itemde.MIP_StoreInfo.getStoreIDs(current.variables.requested_for);
However, this often fails silently.
Common Causes and Troubleshooting Solutions
Here are the most common issues and their step-by-step resolutions:
1. Missing Parentheses During Initialization
Issue: The Script Include was not initialized correctly due to missing parentheses.
Incorrect:
javascript : new x_infte_esm_itemde.MIP_StoreInfo.getStoreIDs(current.variables.requested_for);
Correct:
javascript: new x_infte_esm_itemde.MIP_StoreInfo().getStoreIDs(current.variables.requested_for);
In JavaScript, failing to instantiate the class using () results in the method not being executed properly. Without creating an instance, the call attempts to access the method directly, which fails unless it's defined as static.
Practical Example:
When correctly implemented, your script should resemble:
javascript: new x_infte_esm_itemde.MIP_StoreInfo().getStoreIDs(current.variables.requested_for);
This simple adjustment enables the Script Include to execute as intended.
Another Common Pitfall: Extra Spaces
Be cautious with spacing after javascript. Extra spaces between 'javascript' and ':' might prevent the script from executing.
Incorrect spacing:
javascript : new x_infte_esm_itemde.MIP_StoreInfo().getStoreIDs(current.variables.requested_for);
Correct spacing:
javascript:new x_infte_esm_itemde.MIP_StoreInfo().getStoreIDs(current.variables.requested_for);
Troubleshooting Step-by-Step:
Step 1: Ensure proper syntax with parentheses after class instantiation.
Step 2: Remove any unnecessary spaces between 'javascript' and ':' in the qualifier.
Step 3: Check Script Include accessibility—confirm that "Client Callable" is set to true, and scope privileges are correctly defined.
Additional Debugging Tips for Scoped Applications
When working with scoped applications, the gs.log function does not work as expected. Use gs.info() instead for logging purposes:
gs.info("Script Include successfully called");
This ensures logs will display accurately when debugging within scoped applications.
Example Use Case Scenario:
Suppose a ServiceNow catalog item allows users to request hardware from specific stores. Based on the person making the request, only authorized store numbers should appear in the dropdown. By correctly configuring your Script Include call in the reference qualifier as demonstrated, the store_no field accurately filters store IDs dynamically and reliably based on the logged-in user's permissions.
Alternative Solutions
Cross-Scope Privileges: If you're working in different scopes, ensure you've configured cross-scope privilege records. Incorrect or missing privileges can lead to execution failure.
Direct Calls Without Instantiation: Alternatively, consider static calls if instantiation isn't strictly necessary, such as:
javascript: MIP_StoreInfo.getStoreIDs(current.variables.requested_for);
This alternative simplifies the call but is valid only if the method is explicitly defined as static.
Conclusion: Key Takeaways and Next Steps
In summary, to resolve the issue of a Script Include not being called by a reference qualifier, ensure correct JavaScript syntax with class instantiation (new MIP_StoreInfo()), remove unnecessary spaces, and verify logging methods for scoped applications. By implementing these troubleshooting steps, ServiceNow administrators and developers can effectively enhance their catalog items, leading to more streamlined and dynamic user experiences.
Actionable Next Steps:
Review your reference qualifiers carefully for syntax accuracy.
Validate logging techniques according to application scope.
Regularly test your catalog items to ensure dynamic fields populate as expected.