How to fix it

  1. Navigate to System Definition > Script Includes and open your Script Include record.
  2. Check the Client callable checkbox. If unchecked, check it and click Update. This makes the Script Include accessible from client-side code.
  3. Verify the Script Include Name field exactly matches what you use in new GlideAjax('ScriptIncludeName'). Case matters.
  4. In the Script Include code, ensure your method calls this.setAnswer(returnValue) to send data back to the callback.
  5. Check that the method name in addParam('sysparm_name', 'methodName') exactly matches a function in your Script Include.
  6. Navigate to System Logs > System Log > All and filter by your Script Include name to check for JavaScript errors.
  7. If using the traditional pattern, ensure your Script Include extends AbstractAjaxProcessor and methods are defined as ClassName.prototype.methodName = function().
  8. Test your fix by refreshing the form and triggering the GlideAjax call again.
💡

Add console.log statements in both your client script callback and Script Include method to verify data flow. Check browser console and system logs respectively.

  1. If returning objects or arrays, use this.setAnswer(JSON.stringify(myObject)) in the Script Include and JSON.parse(answer) in the callback.
  2. Clear your browser cache if the Script Include was recently modified, as ServiceNow may cache the old version.