Report with RITM and associated child CTASK.

marybutts
Kilo Contributor

I am trying to run a report on Requested Item that will show me the child Catalog Task.   I know I can run it the opposite way with Catalog Task to show the parent RITM, but I don't want to run it that way.

I believe we have a problem in our system where we have RITM's with no Catalog Tasks being generated, so I am trying to capture that information.   Any ideas?

1 ACCEPTED SOLUTION

Harry Campbell2
Mega Guru

I dont think you could do this as a report. Your best bet would be to run a script that will return a list of RITM's that have no tasks. We used this in a similar situation:



var noTaskCounter = 0;


var gr = new GlideRecord('sc_req_item');


gr.addEncodedQuery('active=true^approval=approved'); //<-- Shows all RITMs that are approved and active - for us, these would be the ones that should have Tasks attached to them


gr.query();


while (gr.next()) {


      //The below will check everything filtered above and find any that dont have any tasks attached


      var tsk = new GlideRecord('sc_task');


      tsk.addQuery('request_item', gr.sys_id);


      tsk.query();


      if (!tsk.next()) {


              gs.info('RITM == {0} has Zero Tasks',gr.number);


              noTaskCounter++;


      }


}


gs.info('Out of {0} RITMs, only {1} had Zero Tasks', gr.getRowCount(), noTaskCounter);



Run this in Scripts - Background (On a sub production instance first) to see if it returns the results you need.



Let me know how you get on.



Harry


View solution in original post

5 REPLIES 5

Not a problem, I'll put that on my CV



If this works for you, could you please mark it as correct so others can find it?



Thanks


Harry