- 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
‎08-29-2019 06:58 AM
Query Business Rule executes not only at the time of accessing the table via UI, but also for any operations [Glide Queries via script] which try to read the table. So if you are observing multiple executions of the Query BR, then please check there are any scripts that are reading the table [Possibilities: GlideAjax calls, Display Business Rules].
Thank you,
A.R.G.
Please mark the answer correct/helpful if applicable!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2019 04:31 AM
Hi,
I wrote the business rule on a developer instance as well where there is no customization. I could still see the addInfo message multiple times on multiple table lists and forms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2019 04:23 PM
Hi All,
I observed that query business rule runs on all tables which references the table on which the business rule is written on but I don't understand why it is being triggered multiple times on each list and form load.
Please help.
Regards,
Sreedhar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2019 04:36 PM
On which table the Query BR is written on ? Is it on TASK table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2019 04:39 PM
Business rule is written on Task with a condition table name is Incident but it is working the same even if business rule is written on Incident.