- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 02:46 AM
Hi All,
I have a requirement to write Query Business rules for ITIL users based on support teams. I need to display records based on following condition.
- Filter A is the list of records based on their support group.
- Filter B is in a case if incidents are raised for the user (requested for / requested by).
Both are connected with OR condition(refer to screenshot).
company=ca60733fdbc75340b828f5461d9619f2^service_offering.cost_center=3cf0306fdbcf9700a9e4f3d61d9619fc^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^NQcaller_id=javascript:gs.getUserID()^ORu_on_behalf_of=javascript:gs.getUserID()^ORu_business_user=javascript:gs.getUserID()
company=ca60733fdbc75340b828f5461d9619f2^service_offering.cost_center=3cf0306fdbcf9700a9e4f3d61d9619fc^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^NQcaller_id=javascript:gs.getUserID()^ORu_on_behalf_of=javascript:gs.getUserID()^ORu_business_user=javascript:gs.getUserID()
Issue is whenever I put ^NQ within addEncodedQuery in Query Business rule, it stops working. Is there any alternate solution for this?
Thanks,
KUMAR
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 04:41 AM
^NQ is not supported in BR query rules. Since your B query only consists of OR queries, you can simply include that into your A query with additional OR conditions.
^NQ is only ever necessary if you have multiple queries each of which consist of multiple AND subconditions that have to be OR'ed together, which is not the case here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 03:15 AM
Hi,
Why don't you use addEncodedQuery instead of addQuery.
Copy the query from the filter and simply use gr.addEncodedQuery() and it should work.
Mark the comment as a correct answer and also helpful once worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 04:00 AM
I tried it. ^NQ doesn't work. that is the issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 04:12 AM
when you say it does not work, are you getting any error?
I just executed this code(few filters with AND and OR) and it is working fine in background script.
var gr=new GlideRecord("incident");
gr.addEncodedQuery("active=true^assigned_to=62826bf03710200044e0bfc8bcbe5df1^NQstate=1^assignment_group=b85d44954a3623120004689b2d5dd60a");
gr.query();
while(gr.next()) {
gs.print(gr.number);
}
I got the same results in the background as i see in the list view.
Mark the comment as a correct answer and helpful if it helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 04:41 AM
^NQ is not supported in BR query rules. Since your B query only consists of OR queries, you can simply include that into your A query with additional OR conditions.
^NQ is only ever necessary if you have multiple queries each of which consist of multiple AND subconditions that have to be OR'ed together, which is not the case here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 07:20 AM