Complex queries with OR and without sysparm_query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 07:22 AM
Hi,
I would like to retrieve list of incidents with this conditions:
(assignment_group=IT Securities AND state IN 'New, In progress') OR number IN 001,002
when I'm using sysparm_query param everything works ok:
.../api/now/table/incident?sysparm_query=assignment_group=5f6441efc0a8010e0177fcb589156352^stateIN1,2^NQnumber=INC0000001
but using this I need to pass assignment_group sys_id and states as int values.
Is there any solution to prepare such query without sysparm_query and pass values as string and still have possibility to add last OR?:
.../api/now/table/incident?assignment_group=IT%20Securities&stateINNew,In%20progress (how insert here ^NQ??)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 11:34 PM
Hi Adrian,
So you want the URL which would return records as per below filter condition.
(assignment_group=IT Securities AND state IN 'New, In progress') OR number IN 001,002
Form this query on incident table and use the same in the URL
here you go
sysparm_query=assignment_group%3D8a5055c9c61122780043563ef53438e3%5EstateIN1%2C3%5ENQnumberININC0010079%2CINC0010078
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 12:07 AM
I already have such solution, I was asking for query without sysparm_query. Is it possible?
Is there any solution to prepare such query without sysparm_query and pass values as string and still have possibility to add last OR?:
.../api/now/table/incident?assignment_group=IT%20Securities&stateINNew,In%20progress (how insert here ^NQ??)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 12:35 AM
Hi Adrian,
you need to use the sysparm_query parameter if you are handling it in URL.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 11:49 PM