- 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
‎12-30-2024 06:45 AM
Hello @Ankur Bawiskar Thank you, this is really great solution, however it stopped working after migration to Xanadu. Do you have any idea what should be changed in Script include or report?
Thank you so much and Happy New Year!
Fotina
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 06:48 AM
Can you post a new thread and tag me there as this is an old thread?
Share all the details along with script you are using and the screenshots.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 07:08 AM
Sure, thank you so much, done Report creation with all Open/inProgress RITMS but... - ServiceNow Community
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2021 02:00 AM
Hi,
It worked for me
It gave only 1 RITM where all SC Tasks are Closed
RITM0010017 - has 1 Closed SC Task and 1 Open SC Task so this was not shown in the report
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader