- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 03:45 AM
Hello everyone,
I'm trying to get a list of RITMs where all the related sctasks are closed but RITM is still in open state.
I'm not able to get this through report. Can you please suggest a way to get the output.
Thanks,Sravani
Solved! Go to Solution.
- Labels:
-
Reporting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2021 01:48 AM
Hi,
So you will have to go with script approach
Script Include: It should be client callable
var ReportUtils = Class.create();
ReportUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getRITM:function(){
var arr = [];
var gr = new GlideRecord("sc_req_item");
gr.addEncodedQuery("state=1"); // state is open
gr.query();
while(gr.next()) {
var closedCount = 0;
var taskRec = new GlideRecord("sc_task");
taskRec.addQuery("request_item", gr.sys_id);
taskRec.query();
var totalCount = taskRec.getRowCount();
while(taskRec.next()){
if(taskRec.active.toString() == 'false'){
closedCount++;
}
}
if(closedCount == totalCount && totalCount != 0){
// if count is same then all tasks are closed then push RITM sys_id in array
arr.push(gr.getValue('sys_id'));
}
}
return arr.toString();
},
type: 'ReportUtils'
});
Condition of Report
sys_id [IS ONE OF] javascript: new ReportUtils().getRITM();
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 08:35 AM
working perfect!!, thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2025 02:31 AM
RITM is open but all sctasks are closed
I tried this It didn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 07:44 AM
Hello Ankur,
Thanks for the reply. I've tried using your condition but it didn't work. The report is giving the list of the RITMs to which sctasks are closed.
But when opened a RITM there are some other tasks which are in open state.
I need to report on all the open RITMS even when ALL the related sctasks are closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 08:06 AM
Hi,
It would show those RITMs which are OPEN and for those RITMs the SC Tasks are Inactive means task is closed
It's an AND condition
The conditions are proper; looks your data is incorrect.
If sc_task for that RITM is inactive then it should be closed
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2021 12:23 AM
Hello Ankur,
Yes, you are right! It is listing all the Open RITMS with the related list of sctasks closed.
For suppose there are 10 sctasks under one RITM in which 9 sctasks are closed.
By the conditions we gave, we are getting a report(output) of one Open RITM with 9 sctasks closed.
It won't list the 1 open sctaks due the conditions given, which is correct.
Here we are looking for a list where all 10 sctasks are closed but the RITM is opened.