GlideFilter - Scoped, Global
-
- UpdatedJan 30, 2025
- 5 minutes to read
- Yokohama
- API reference
The GlideFilter API enables filtering queries to determine if one or more records meet a specified set of requirements.
Methods for this API are accessible using the GlideFilter global object.
Case sensitivity
The GlideFilter API is case-sensitive by default. Use the setCaseSensitive() method to enable or disable case sensitivity. GlideRecord queries are case-insensitive.
The following example shows how a GlideRecord query is case-insensitive and results in the same user record with upper or lower case.
The following example shows how GlideFilter only retrieves the matched value of the record for the upper case condition. The lower case condition does not provide a match.
The following example shows how to disable GlideFilter case-sensitivity with the setCaseSensitive() method. The filter matches the condition even though the case does not match the field value.
Filter null values
ISNOTEMPTY
to the query condition. The following example shows how using the same encoded query with GlideRecord
and GlideFilter produces different results. The output shows that GlideRecord returns three records, skipping empty date values. The
GlideFilter query counts the empty date value and returns a count of four records.AND
condition ISNOTEMPTY
to the queried
field. Output shows that the GlideFilter encoded query skips the null date value and counts three
results.GlideFilter – GlideFilter(String filter, String title)
Instantiates a GlideFilter object.
Name | Type | Description |
---|---|---|
filter | String | Encoded query string in standard Glide format.
See Encoded query
strings. Results are case-sensitive, unless disabled using the setCaseSensitive()
method. To exclude null values from GlideFilter query results, add ISNOTEMPTY to the query condition. |
title | String | Descriptive title for the filter. |
Example
The following example shows how to filter the number of users named Rebekah.
GlideFilter - checkRecord(GlideRecord now_GR, String filter, Boolean match)
Compares a specified filter to the contents of a specified GlideRecord.
If the specified filter contains one condition, the method returns true if the record meets the condition.
Filters support multiple conditions, for example
"active=true^number=abc^category=request"
. You can use the
match parameter to define whether all conditions must be met to
determine a match or just a single condition.
Name | Type | Description |
---|---|---|
now_GR | GlideRecord | GlideRecord to evaluate. |
filter | String | Encoded query string in standard Glide format.
See Encoded query
strings.
To exclude null values from GlideFilter query results, add ISNOTEMPTY to the query condition. Note: The filter values
are case-sensitive. In addition, you cannot use setCaseSensitive(false) to change the change the
case-sensitive value. |
match | Boolean | Optional. Flag that indicates whether all conditions must be met if the
filter parameter contains multiple conditions. Valid values:
Default: true |
Type | Description |
---|---|
Boolean | Results of the filter comparison.
|
Example
The following example shows how to display true for each record in the Incident table that meets the filter condition. False otherwise.
GlideFilter - match(GlideRecord now_GR, Boolean match)
Evaluates a filter against a specified GlideRecord.
Name | Type | Description |
---|---|---|
now_GR | GlideRecord | GlideRecord to evaluate. |
match | Boolean | Flag that indicates whether all filter conditions must match. Valid values:
Default: false |
Type | Description |
---|---|
Boolean | Results of the match check.
|
Example
The following example shows how to ensure the filter conditions match against the GlideRecord provided.
GlideFilter - setCaseSensitive(Boolean caseSensitive)
Enables or disables case-sensitive filter results.
Name | Type | Description |
---|---|---|
caseSensitive | Boolean | Flag that indicates whether the filter is case-sensitive. Valid values:
Default: true |
Type | Description |
---|---|
None |
Example
The following example shows how to disable case-sensitive results.
Output shows that the filter retrieves upper case results with a lower case condition.
GlideFilter - setEnforceSecurity(Boolean enforceSecurity)
Enables or disables sandboxed evaluation of the filter string.
Name | Type | Description |
---|---|---|
enforceSecurity | Boolean |
Flag that indicates whether to evaluate the filter in the sandbox. Valid values:
Default: false |
Type | Description |
---|---|
None |
Example
The following code example shows how to call this method.
Output:
On this page
- Case sensitivity
- Filter null values
- GlideFilter – GlideFilter(String filter, String title)
- GlideFilter - checkRecord(GlideRecord now_GR, String filter, Boolean match)
- GlideFilter - match(GlideRecord now_GR, Boolean match)
- GlideFilter - setCaseSensitive(Boolean caseSensitive)
- GlideFilter - setEnforceSecurity(Boolean enforceSecurity)