Is there any rest api that enables me to find all the incidents based on the sys_id value of the assignment group and the service group ?

Joby3
Kilo Contributor

I'm trying to list all the incidents based on the service and the assigned group sys id that I am a part of. I'm trying to make this call through rest api. 

Could you please help me with the rest service call for the same?

3 REPLIES 3

kevinclark-7EL
Tera Contributor

You can define a sysparm_query parameter for the normal Table REST API which will add the "Dynamic" search query.

 

Build whatever query you want on the Table REST API request in a list view - I just pulled up a list and selected "Assignment Group is (dynamic) one of my groups" but you can use whatever query you want:

find_real_file.png

 

You can then right-click on the filter breadcrumbs and click "Copy Query" to grab the encoded query:

find_real_file.png

Mine came up as "assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744".  I believe that the dynamic query SysID is common to all instances, so that query string *should* work in almost any instance as a REST query as below, however if it doesn't work, you should be able to copy the encoded query using the method above. 

Here's the "Assigned to me" REST API call that returns incidents where I'm in the assignment group:

https://<INSTANCENAME>.service-now.com/api/now/table/incident?sysparm_query=assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744 

 

You will obviously also need to pass Authentication for the user that you're interested in, and that user will need to have READ ACL access to the table you're querying.

Thank you for the swift response. I could get it to work with the stipulated steps.

No worries!  Glad I could help.