How can I filter incidents based on their cancellation or closure dates using the task sla table

JohnDF
Mega Sage

Hi everyone,

I'm trying to filter SLAs from the task_sla table based on the closure or cancellation dates of their associated incidents.

Specifically, I want to retrieve SLAs for incidents that were closed or canceled within specific timeframes, such as:

  • Last month
  • Last 3 months
  • This month
  • Last 6 months

For example, I'd like to see all SLAs for incidents that were closed or canceled within the last month.

Could someone please advise on how to achieve this filtering?

 

This is my filter so far, but this is incorrect i thinks its filter only on closed at date?

JohnDF_0-1722329476411.png

 

Thanks for your help!

1 ACCEPTED SOLUTION

Hi @JohnDF 

Absolutely we can dot-walk to child task-related tables. There you go.

Timi_0-1722330698047.pngTimi_1-1722330702138.png

Timi_2-1722330712746.png

 

When an Incident or Requested Item get cancelled, the Closed [closed_at] field will be populated, you can base on it for the date time filter.

 

I'm looking to get the date when any task type is set to inactive, not just incidents. I'll need to expand this to other task types like ritm later on.

=> No problem at all. It's just if we leverage a database view for specific child tables, it could potentially benefit performance later on by reducing the huge amount of data within the task_sla table.

 

Cheers,

Tai Vu

View solution in original post

3 REPLIES 3

Tai Vu
Kilo Patron
Kilo Patron

Hi @JohnDF 

There is a specific database view for Incident SLA [incident_sla] that you can leverage for your scenario.

To see all SLAs for incidents that were closed or canceled within the last month, you can use the following URL as a sample:

https://<instance_name>.service-now.com/incident_sla_list.do?sysparm_query=inc_incident_stateIN7,8^inc_closed_atONLast%20month@javascript&colon;gs.beginningOfLastMonth()@javascript&colon;gs.endOfLastMonth()

 

Cheers,

Tai Vu

Hi @Tai Vu thanks for your reply.
While the example you provided was helpful, I need to apply this concept to the task_sla table, not just the incident table. I'm looking to get the date when any task type is set to inactive, not just incidents. I'll need to expand this to other task types like ritm later on.

Is there a way to "dot walk" from the task_sla table to the related task (like an incident or a RITM) and then access the fields to determine when the task was set to inactive/closed?

Thanks again for your assistance!

Hi @JohnDF 

Absolutely we can dot-walk to child task-related tables. There you go.

Timi_0-1722330698047.pngTimi_1-1722330702138.png

Timi_2-1722330712746.png

 

When an Incident or Requested Item get cancelled, the Closed [closed_at] field will be populated, you can base on it for the date time filter.

 

I'm looking to get the date when any task type is set to inactive, not just incidents. I'll need to expand this to other task types like ritm later on.

=> No problem at all. It's just if we leverage a database view for specific child tables, it could potentially benefit performance later on by reducing the huge amount of data within the task_sla table.

 

Cheers,

Tai Vu