To pick RITM which are in open state once after the closure of child tasks.

vardhan3
Tera Contributor
 
1 ACCEPTED SOLUTION

swathisarang98
Giga Sage
Giga Sage

Hi @vardhan3 ,

 

Could you please elaborate your requirement ?

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

View solution in original post

9 REPLIES 9

swathisarang98
Giga Sage
Giga Sage

Hi @vardhan3 ,

 

Could you please elaborate your requirement ?

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

write a script to pick RITM which are in open state once after the closure of child tasks(catalog tasks and approval tasks)

Hi @vardhan3 ,

 

Please find the below code,

 

var arr = [];
var gr = new GlideRecord('sc_task');
gr.addEncodedQuery('stateIN3,4,7');
gr.query();
while(gr.next()){
    var ritm = new GlideRecord('sc_req_item');
    ritm.addQuery('sys_id', gr.request_item.toString());
    ritm.addQuery('active',true);
    ritm.query();
    while(ritm.next()){
        arr.push(ritm.number.toString() + "\n");
    }
   
}
 gs.print("RITM number: " + arr );

 

 run this in background script

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,

Swathi Sarang

 

Hi Swathi

Thank you for script but when I checked the output in background script there is one RITM whose sc task is still open and when I checked one scenario like create another sc task under existing closed sc task then that RITM also coming in final result . Kindly check and confirm.

Please check the attached screenshot.

our requirement : To pick up RITM which are in open state once after the closure of child tasks

vardhan3_0-1710760220699.png