Advanced reference qualifier not working undefined is not a function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2022 08:31 AM
Attempting to call a script include from an advanced reference qualifier that queries a table using the value of a string field on the form. Zip field, string, 5 digits. County field, references table that contains all counties in a state and their corresponding zip codes. Reference qualifier should return all counties associated with the Zip in the string field or "Out of state" (which is also a record in the counties table) if the Zip does not exist in the table. I'm receiving an error in the system logs com.glide.script.RhinoEcmaError: undefined is not a function. Also is this script correct to return the values correctly? Also unclear on how to return Out of State. This is in the customer service scope.
Current reference qualifier: javascript: new TESTAjaxCountyUtil.getCounties(current.zip);
Script include:
var TESTAjaxCountyUtil = Class.create();
TESTAjaxCountyUtil.prototype = {
initialize: function() {
},
getCounties: function (zip) {
var counties = [];
var grMatch = new GlideRecord('u_m2m_zip_counties');
grMatch.addQuery('u_zip_code',zip);
grMatch.query();
while (grMatch.next()) {
counties.push(grMatch.u_zip_code.sys_id);
}
return 'sys_idIN' + counties;
},
type: 'TESTAjaxCountyUtil'
};
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2022 08:42 AM
I've tried it in the customer service scope as well as in the global scope with a qualifier with the same result.