Complex queries with OR and without sysparm_query

yooreck
Kilo Explorer

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??)

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

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


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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??)


Hi Adrian,



you need to use the sysparm_query parameter if you are handling it in URL.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Harsh Vardhan
Giga Patron

Can you try using dynamic operator.



find_real_file.png



then copy that query and paste it in your sysparm_query