View Incidents where all tasks are closed

M_Gilbert
Kilo Contributor

Hi,

We have a use case where we want to see Incidents where 'ALL' Incident Tasks are closed.  If 'any' incident task is open then this should be filtered out.

 

Example

So if an Incident has 2 tasks (1 Open and 1 Closed) this should be filtered out.  If both tasks however are closed then it should be included.

Can't see how this can be achieved.

9 REPLIES 9

Onkar Pandav
Tera Guru

Hi,

In filter condition there is option called "Related list condition".

Select "Incident task->Incident" and give condition for "State - is - Closed".

Give it a try.

andersbogsjo
Tera Guru

Hi!

You can do that by using Reletaed List Conditions in a report

See here

https://docs.servicenow.com/bundle/newyork-platform-user-interface/page/use/using-lists-v3/task/create-related-list-query.html

Regards

Anders

Yash Agrawal1
Tera Guru

Hello,

Please try the below code in background script.I tried it is working fine.

var gr=new GlideRecord('incident_task');
gr.addQuery('incident.number','STARTSWITH','INC');
gr.addQuery('state',3);//assuming close as 3
gr.query();
while(gr.next())
{
gs.print(gr.incident.number+'\n');
}

Please Mark it helpful/correct if my answer helps in any way to resolve your query.
Reach out to me if any more help required.

Regards

Yash.K.Agrawal

Priyanka Vasant
Tera Guru

Hi,

 

With help of related list condition you can achieve that.

Please find the below image for the same.

find_real_file.png

 

Mark helpful or correct based on impact.

Regards,

Priyanka