How to get list of RITM which doesn't have any associated Ctasks.

Vijay Baokar
Kilo Sage

Hello Folks,

 

I am trying to get list of RITMs which are opened 90 days ago, active true, approval is not waiting for approval and those RITMs doesn't have any Ctask associated with them.

 

(function() {
var ritmGr = new GlideRecord('sc_req_item');
ritmGr.addEncodedQuery('stage!=waiting_for_approval^active=true^opened_atRELATIVELT@dayofweek@ago@90');
ritmGr.query();
 
while (ritmGr.next()) {
var Ctask = new GlideRecord('sc_task');
Ctask.addQuery('request_item', ritmGr.sys_id);
Ctask.query();
while(Ctask.next())
 
gs.info('Ctask Number: ' + Ctask.number);
}
})();
 
but this will give me list of Ctask which are created against RITM but i need list of RITMs which doesn't have any Ctask associated with them.
6 REPLIES 6

instead of setLimit, use chooseWindow function.

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Vijay Baokar ,

 

Check this out ! its simple with a report

 

IMPORTANT : select no in the realted list conditons

 

SohailKhilji_0-1715693931065.png

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect