Get incidents and their related problem record using REST API

Hans11
Kilo Contributor

Hi all,

I would like to extract a list of major incidents (MIM) and their related problems using REST API.

I can import the tables for both incidents and problems, but i cannot get any data on the relation between both tables.

Either the MIM query should return a problem record, or the problem query should return a MIM record.

My goal is to report on the close codes of problems that are linked to major incidents.

Has anyone experience with this?

 

kind regards, Hans.

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Why not use reporting for this instead of using API approach?

Out of the box table APIs would give you data from single table only unless you use Table API for view table.

One thing you can have is; create a database view by joining both the tables and then use that table in the API to retrieve the records

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hans11
Kilo Contributor

Hi Ankur,

Thank you for your response!

The reason for using REST API is to use the clients existing reporting environment. Your suggestion to join the two tables looks like the answer to my question. Could you give me a hint or point me to any documentation on how to realize this specific join?

kind regards,

Hans

Hi,

Also each incident has only 1 problem record associated to it;

you can create database view with those 2 tables with condition similar to incident_problem_id = problem_sys_id && incident_priority=1

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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