Many of us use GlideFilter to compare condition fields to a particular record to see if the record matches the condition.
You’ll see an example of this in the Process SLAs business rule where the system runs through all the SLA definitions and checks if the current record matches the conditions on the SLA definition.
I have been using this recently on some custom code and configuration and noticed something that has never cropped up before, namely that the conditions are case sensitive. So what this means the conditions ‘name=ahmed’ is different to ‘name=Ahmed’.
Usually this doesn’t impact me because I don’t use free text fields on conditions, but in this scenario I needed to. What makes this more difficult is that GlideRecord is case insensitive. So if I did a gr.addQuery(‘name’,’ahmed’) it would bring back all records where name was ‘ahmed’ or ‘Ahmed’.
So with a bit (a lot of) digging and searching blogs and community posts, I found a solution to this.
So the original code that’s used is:
var matches = GlideFilter.checkRecord(currentRecord, conditionString);
The new code isn’t quite as concise, but works in the exact same way:
var filter = new GlideFilter(conditionString, “rule”);
matches = filter.match(currentRecord, true);
Using this, you can even create a ‘case sensitive’ field on the configuration table you’re ready from and then set the case sensitive flag accordingly.