How to configure Database View to get Incidents without Outages

ujjwalpundi
Tera Contributor

How to build Database View to report Incidents without Outages with specific conditions.

Could someone please guide me:

  1. How to configure the Database View with a LEFT join so I can capture incidents without outages.
  2. How to apply conditions on Incident fields in the same report.

    Thanks in Advance
1 ACCEPTED SOLUTION

Nitish Saini
Mega Guru

Hi @ujjwalpundi 

Create a Database View for Incidents without Outages

  1. Create Database View

    • Name: u_incident_without_outage_view

    • Label: MIM Incident Without Outage

    • Plural: MIM Incidents Without Outage

  2. Add Tables to the DB View

    • First Table:

      • Table: incident

      • Prefix: inc

      • Where clause: leave blank

      • Left join: false

    • Second Table:

      • Table: cmdb_ci_outage

      • Prefix: out

      • Where clause: inc.number = out.task_number

      • Left join: true

  3. Save the Record

    • After saving, verify it by clicking the “Try It” link in the related links.

    • This will display incidents, and if there is no outage, the outage fields (out.*) will remain empty.

  4. Create a Report

    • Navigate to Reports > Create New.

    • Select the table with the label name you defined (e.g., MIM Incident Without Outage).

    • From here, you can:

      • Select columns from both tables (incident → inc.*, outage → out.*).

      • Apply filters on Incident fields,

        • Or any other custom conditions from both the tables as per requirement.


This way, the report will show all Incidents without outages, and you can still apply any Incident-level filters you need.

Please accept my answer and mark as helpful/correct if it resolves your query.

Regards, 
Nitish Saini 



View solution in original post

6 REPLIES 6

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @ujjwalpundi 

You can do it without using a database view. Create a report on the Incident table, and in the related list, configure it like this:

 

DrAtulGLNG_0-1757679218509.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @ujjwalpundi 

 

You can do without DB view as well.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

SunilKumar_P
Giga Sage

Hi @ujjwalpundi would you be able to share thescreenshot of outage and incident forms?

Nitish Saini
Mega Guru

Hi @ujjwalpundi 

Create a Database View for Incidents without Outages

  1. Create Database View

    • Name: u_incident_without_outage_view

    • Label: MIM Incident Without Outage

    • Plural: MIM Incidents Without Outage

  2. Add Tables to the DB View

    • First Table:

      • Table: incident

      • Prefix: inc

      • Where clause: leave blank

      • Left join: false

    • Second Table:

      • Table: cmdb_ci_outage

      • Prefix: out

      • Where clause: inc.number = out.task_number

      • Left join: true

  3. Save the Record

    • After saving, verify it by clicking the “Try It” link in the related links.

    • This will display incidents, and if there is no outage, the outage fields (out.*) will remain empty.

  4. Create a Report

    • Navigate to Reports > Create New.

    • Select the table with the label name you defined (e.g., MIM Incident Without Outage).

    • From here, you can:

      • Select columns from both tables (incident → inc.*, outage → out.*).

      • Apply filters on Incident fields,

        • Or any other custom conditions from both the tables as per requirement.


This way, the report will show all Incidents without outages, and you can still apply any Incident-level filters you need.

Please accept my answer and mark as helpful/correct if it resolves your query.

Regards, 
Nitish Saini