Filter REQs, RITMs or SCTASKs in a Pending state where the parent Case is Closed

Peter Kelly1
Kilo Contributor

Hello,

To verify whether we have a defect on our implementation of ServiceNow, I am trying to produce a list of Catalog Tasks (SCTASKs) or Request Items (RITMs) or Requests (REQs) where:

  • State of the SCTASK/RITM/REQ is [Pending] or [Work in Progress]
  • State of the parent Case is [Closed]

I have tried 'dot walking' in the filter builder but I am unable to find the appropriate Related Field to use in order to filter a list of these ticket types by the State of their parent Cases. Is this possible?

Any help figuring out this filter would be much appreciated!

1 ACCEPTED SOLUTION

Hi Peter, this is absolutely possible.

All you need to do is go to list view, open condition builder and first identify which field is having parent case. Suppose it is Parent field then you just have to type parent in the filter and select parent=> Task fields. This will show you the fields of parent table.

find_real_file.png

Then again click on the parent fields and you will be able to see the fields of parent record and select 'state' field there and then apply your condition. This will give you the list of records as per your condition.

find_real_file.png

Above example I took for RITMs. Hope that answers your question.

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

View solution in original post

5 REPLIES 5

Mohit Kaushik
Mega Sage
Mega Sage

Hi Peter,

How is the parent case defined here? Is it present in the 'parent' field or there is a separate field for 'case'. So we need to figure out that first and once we have that info, we can just write scripts to get the result. Script can be something like this.

 

var ritm = new GlideRecord('sc_req_item');
ritm.addEncodedQuery('stateIN-5,2^parent.state=3'); // considering the 'parent' field is used for parent cases.
ritm.query();
while(ritm.next())
{
gs.info('RITM number '+ritm.number);
gs.info('Parent '+ritm.parent.getDisplayValue());
}

Similarly you can write the script for sc task and requests also.

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Hi Mohit,

Thank you very much for your suggestion - unfortunately I'm afraid I am a ServiceNow ITSM user rather than an admin or developer so I do not have access to writing scripts.

I was hoping there might be a way to do this in the TasksRequests or Requests Items list views, if this is possible?

Hi Peter, this is absolutely possible.

All you need to do is go to list view, open condition builder and first identify which field is having parent case. Suppose it is Parent field then you just have to type parent in the filter and select parent=> Task fields. This will show you the fields of parent table.

find_real_file.png

Then again click on the parent fields and you will be able to see the fields of parent record and select 'state' field there and then apply your condition. This will give you the list of records as per your condition.

find_real_file.png

Above example I took for RITMs. Hope that answers your question.

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Peter Kelly1
Kilo Contributor

Hi Mohit,

Many apologies for the late response - thanks very much, that's exactly the filter I needed. Thank you so much for your help.