- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I have a Business Rule on sc_task with filter conditions for only two specific catalog items.
I noticed that an update on a task belonging to a different catalog item was still triggering the Condition script. To test, I added:
and I can see the log being generated even when the record does not meet the filter conditions.
My understanding was that the execution order is:
So I'm wondering:
Why is the Condition script being evaluated when the record does not satisfy the filter conditions? Is this expected behavior in ServiceNow?
Thanks in advance for any insights.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @gurralanavi ,
According to the document below, Filter Conditions and Advanced Condition scripts in ServiceNow are evaluated simultaneously, so seeing your log fire even when the record doesn’t match the filter is expected behavior.
Classic Business rules • Australia Build workflows • Docs | ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @gurralanavi ,
According to the document below, Filter Conditions and Advanced Condition scripts in ServiceNow are evaluated simultaneously, so seeing your log fire even when the record doesn’t match the filter is expected behavior.
Classic Business rules • Australia Build workflows • Docs | ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @gurralanavi,
This is expected platform behavior. ServiceNow evaluates both the UI Filter Conditions and the advanced Condition Script simultaneously as a combined boolean check before deciding whether to execute the Business Rule.
To prevent your condition script from evaluating unnecessarily, the cleanest fix is to clear the Condition Script field entirely and handle the check inside your main script body instead:
(function executeRule(current, previous) {
// Perform your check inside the script body
if (!current.request_item.nil() && current.request_item.cat_item == 'TARGET_SYS_ID') {
// Your logic here
}
})(current, previous);
This ensures your logic only runs when all criteria are met.
Hope this helps!
Thank you!
Juhi Poddar
Juhi Poddar
