- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 06:28 AM
Hi All,
I have written a query business to restrict record access based on few conditions. While testing, i found that business rule is being executed multiple times for a single incident record. Could you please help me understand why.
Regards,
Sreedhar
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2019 09:33 PM
Example: I load an Incident Form.
The before Query Incident Business rule runs 3 times:
- One for the current Incident
- One for the Major Incident related list
- One for a display business rule that queries incident
Output of each query:
Display Business Rule
Related List
Each time the system runs .query() on Incident, the before query rule runs to append any queries you have added or removed from the Before query rule.
See what happens if I add "active=true" to my Incident Before Query rule:
Active=true is now appended to all queries on the Incident Table.
This is how before Query rules are used.
P.S. Conditions on fields don't work on these rules, as it isn't running on a record but on a table query.
That is the fundamental mindset shift.
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
‎09-05-2019 09:33 PM
Example: I load an Incident Form.
The before Query Incident Business rule runs 3 times:
- One for the current Incident
- One for the Major Incident related list
- One for a display business rule that queries incident
Output of each query:
Display Business Rule
Related List
Each time the system runs .query() on Incident, the before query rule runs to append any queries you have added or removed from the Before query rule.
See what happens if I add "active=true" to my Incident Before Query rule:
Active=true is now appended to all queries on the Incident Table.
This is how before Query rules are used.
P.S. Conditions on fields don't work on these rules, as it isn't running on a record but on a table query.
That is the fundamental mindset shift.
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
‎09-19-2019 08:03 AM
Hi Paul,
Is there a significance to order in case of a before query business rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2019 04:26 AM
Hi Paul,
Thanks for the explanation.
In my instance, I could see addInfomessages being displayed almost 50 times when I open an incident. Please let me know if there could be any performance issues.
Regards,
Sreedhar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2022 06:53 AM
To identify the business rules and flows that run on a record when inserting, updating, deleting, displaying or querying the record the DevTools' WhatRuns button comes in handy.
As the name suggests it shows you what runs on a record (including business rules on parent tables).
DevTools contains a truckload of re-usable functions and features for developers.
Fork at will: