To get database view for incident and task_sla table

Sharvan
Giga Guru

I want to create a database view in which i can get all the incidents which has SLA OR does not have SLA(incidents with or without SLA). 'incident_sla' table already shows record which has SLA but does not show incident without SLA.

Can someone help me to write 'where clause' query to get all incidents with OR without SLA.

3 REPLIES 3

traceymaycock
ServiceNow Employee
ServiceNow Employee

Hi Sharvan,



To get a list of all incidents, regardless of whether they have an SLA or not, you need to look at the incident table or the task table:



https://instance.service-now.com/incident_list.do


https://instance.service-now.com/task_list.do?sysparm_query=sys_class_name%3Dincident



I would always recommend filtering this by at least the 'Active' column, to show you either all the open incidents or all the closed incidents, depending on your needs:



https://instance.service-now.com/incident.do?sysparm_query=incident%5Eactive%3Dtrue


https://instance.service-now.com/incident.do?sysparm_query=incident%5Eactive%3Dfalse



https://instance.service-now.com/task_list.do?sysparm_query=sys_class_name%3Dincident%5Eactive%3Dtru...


https://instance.service-now.com/task_list.do?sysparm_query=sys_class_name%3Dincident%5Eactive%3Dfal...



Hope this helps.



Kind regards



Tracey


Jaspal Singh
Mega Patron
Mega Patron

Hi Shravan,



You can create a database view as below for getting what is expected.



find_real_file.png


Hi Jaspal,



Thank you for your reply but i resolved it by applying the below query and left join.



find_real_file.png