- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 03:28 AM
Hello,
I have a question, how can I create a report (or list it via script) with all open RITMs (State == Open) but where all fulfillment tasks are closed? In other words when there is for example a request which has 5 tasks and all of them are closed but state of the request is Open, then I need that to show in my report.
Aby help much appreciated!
Solved! Go to Solution.
- Labels:
-
Analytics and Reports
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 04:21 AM
Hello
you can try this below script .
I tried this in Background script with the same scenario and it worked
var arr=[];
var gr= new GlideRecord('sc_req_item');
gr.addQuery('state',1);
gr.query();
while(gr.next())
{
var ct = new GlideRecord('sc_task');
ct.addQuery('parent',gr.sys_id);
ct.query();
while(ct.next())
{
if(ct.state==3||ct.state=="3")
{
if(arr.indexOf(gr.number.toString())==-1)
{
arr.push(gr.number.toString());
}
}
}
}
gs.print(arr);
Please mark my answer correct if it helps you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 03:29 AM
Hi you can pull a report on SC_task table by dot walk to RITM, You will get both state values here
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 03:39 AM
Hello,
Yes, but how can I check if all tasks assigned to RITM are closed on sc_task table?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 04:21 AM
Hello
you can try this below script .
I tried this in Background script with the same scenario and it worked
var arr=[];
var gr= new GlideRecord('sc_req_item');
gr.addQuery('state',1);
gr.query();
while(gr.next())
{
var ct = new GlideRecord('sc_task');
ct.addQuery('parent',gr.sys_id);
ct.query();
while(ct.next())
{
if(ct.state==3||ct.state=="3")
{
if(arr.indexOf(gr.number.toString())==-1)
{
arr.push(gr.number.toString());
}
}
}
}
gs.print(arr);
Please mark my answer correct if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 04:55 AM
Thank you, this script works like a charm!