- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2015 08:50 AM
Hi community,
I'm writing a module that utilizes the condition builder field paired with the GlideFilter API to allow users to define when a certain event triggers. The condition builder + GlideFilter work perfectly if the condition builder is attempting to match on strings, choice fields, bools, etc., but when trying to match on reference fields, it always returns false.
Here's the code. It runs on the task table with a before/update business rule, looking for "checklist definitions" that match.
function getChecklistDefinition () {
var def = new GlideRecord('u_checklist_def');
def.addQuery('u_table', current.getRecordClassName());
def.query();
while (def.next()) {
if (GlideFilter.checkRecord(current, def.u_condition)) {
return def;
}
}
return false;
}
I know for a fact that I've been able to use GlideFilter.checkRecord with ref fields before in the past, so this is kind of driving me crazy. Any thoughts as to why it's not working now would be greatly appreciated.
Thanks!
Kevin
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2015 07:20 PM
Check the value of 'u_condition' against a 'copy query' of the result you are hoping for in a list.
Long shot: I have found in Fuji that it makes the length of the condition field really short by default and it truncates after save.
Check the 'max length' of the dictionary entry and increase it if necessary.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2015 02:37 PM
Are you trying to match on string fields?
Using check record String field matches are case sensitive.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2015 07:20 PM
Check the value of 'u_condition' against a 'copy query' of the result you are hoping for in a list.
Long shot: I have found in Fuji that it makes the length of the condition field really short by default and it truncates after save.
Check the 'max length' of the dictionary entry and increase it if necessary.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2015 08:00 PM
You nailed it, Paul. The max length was set to 40 chars. Fuji must have removed that field from the dictionary form, and I hadn't even thought to check.
Wonderful. Thank you so much!