Using GlideFilter.checkRecord
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 02:04 AM
Hi All,
For one of the requirement, we are using "GlideFilter.checkRecord(current,sla_record.start_condition)". this actually checks the current sc_task record and the start condition of the SLA record.
But in the start condition of the sla record, we also have few conditions referring to requested Item table which is parent of sc_task. In this case this is not working. even though we have those reference fields in sc_task record. can some please let me know how can we do this?
Regards,
Vasanth
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 02:07 AM
Can you share the start condition?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 02:26 AM
Hi Andrew,
Thanks for replying!
Below is an example of the start condition.
Ex: The SLA is running on sc_task table and in start condition we have:
Active is true AND Assignment Group.Service Provider is "EXAMPLE" AND Request Item.Priority is "EXAMPLE"
This is how the start condition looks and in sc_task table we have a field "request item" as well which is a reference and it refers to the parent.
When I remove the condition Request Item.Priority is "EXAMPLE" from the SLA, the script returns correctly. when I include this it doesn't.
Regards,
Vasanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 02:29 AM
Does your query contain multiple conditions?
You may need to add a third parameter
checkRecord(GlideRecord gr, String filter, Object matchAll)
Your code should then be
GlideFilter.checkRecord(current,sla_record.start_condition, true)
The method returns true when the record meets the filter condition. If the filter is composed of one or more "AND" conditions for example"active=true^number=abc^category=request"and the matchAll parameter is set to false, then if any of the conditions is true then true is returned. If the matchAll parameter is true, then all conditions in the filter must be true in order to return true.
Name | Type | Description |
---|---|---|
gr | GlideRecord | The GlideRecord to be evaluated. |
filter | String | An encoded query string. |
matchAll | Object | (Optional) If true and the encoded query string contains multiple conditions then all conditions must be true for the method to return true. If false and the encoded query string contains multiple conditions then only one condition needs to be true for the method to return true. If the encoded query string has only one condition, this parameter has no impact. |
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
‎01-17-2018 02:46 AM
Hi Paul,
Thanks to you too.
Yes we have multiple conditions in the SLA, as I mentioned in my previous reply.
How do I include the 3rd parameter? Since this is throwing me errors:
GlideFilter.checkRecord(current,sla_record.start_condition, sla_record matchAll);
Please help me with this.
Regards,
Vasanth