Complex query with and and or conditions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2017 03:12 AM
Hello,
I'im trying to create a complex query with and and or conditions.
What is working is a mix of and and or like that : (U OR V) AND (W OR Y OR Z).
What is need is a mix like this : (A AND B) OR C OR D OR E
My code :
var qc = current.addQuery('locationIN' + locations);
qc.addQuery('u_visible_by_external_provider', true);
var qr = current.addOrCondition('assignment_group', IN', Usergroups);
qr.addOrCondition('caller_id', u);
qr.addOrCondition('opened_by', u);
But is don't work
I've also tried with and encode query but there is a know bug by ServiceNow (https://community.servicenow.com/message/963069#963069 and
Could you help me please ?
Jean-Luc
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 06:00 AM
Hi Jean-Luc,
I have the same requirement.
Did you find a way to solve it and implement a query like (A AND B) OR (C AND D) in a query BR (ie without NQ operator)
Merci
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 07:12 AM
Hi Patrick,
No, I didn't find a solution and gave up ! I've simplified my needs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 08:37 AM
Dommage !
The only solution that I found is to rewrite query like (A OR B) AND (C OR D) to
(A or C) AND (A Or D) AND (B OR C) AND (B OR D)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2017 02:37 AM
The only solution I found is by using encoded query. Even I would like to know if anyone know the answer for it.