- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2018 04:28 AM
Hi
How can I add OR statements by using the following REST API URL:
https://company.service-now.com/api/now/stats/incident?sysparm_count=true&assignment_group=Grup-Name&state=2
I tried the following way:
https://company.service-now.com/api/now/stats/incident?sysparm_count=true&assignment_group=Grup-Name&state=2^OR_state=3
Thanks in adwance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2018 10:53 AM
Hi Luca,
Your best bet when trying to learn how to write more complex query statements is to view a list on the table of interest, and then use the filter icon at the top to build out your query as desired. Once you have that created, you can simply right-click on the last condition in the filter breadcrumbs and choose "Copy query" to get a properly formatted encoded-query statement.
(copied to clipboard): assignment_group=9939670d6f30b508a4c2211bbb3ee48d^stateNOT IN2,3
Give that a try,
-Brian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2018 06:13 AM
you can do below. you don't need _ after OR
https://company.service-now.com/api/now/stats/incident?sysparm_count=true&assignment_group=Grup-Name&state=2^ORstate=3
for Assignment group you need to pass in sysid of group. If you want to pass in name do below
https://company.service-now.com/api/now/stats/incident?sysparm_count=true&assignment_group.name=Grup-Name&state=2^ORstate=3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2018 06:55 AM
Hi Mike
Thank you for your reply.
I tried but I get the following error:
<response>
</response>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2018 07:06 AM
try below, it works for me.
https://xxx.service-now.com/api/now/table/incident?sysparm_query=state%3D2%5EORstate%3D3%5Eassignment_group.name%3DGrup-Name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2018 07:15 AM
Really appreciate Mike, it works but this gives me an XML with too much information.
I just try to get the total count of incidents that have not the stauts is not one of resolved or closed