RITM should get close once all catalog tasks are closed

tulasi8
Tera Contributor

Hi Community,

 

I want the RITM should get close only once all the catalog tasks are closed. I have written the business rule for this after update with the condition as state is closed complete.  But it's not working as per requirement. Can anyone please help on this. 

 

    var gr = new GlideRecord("sc_task");
    gr.addActiveQuery();
    gr.addQuery("request_item", current.request_item);
    gr.setLimit(1);
    gr.query();
    if (!gr.hasNext()) {
        var ritm = current.request_item.getRefRecord();
        ritm.state = current.state;
        ritm.update();
    }
 
Thanks,
Tulasi.
15 REPLIES 15

Look Up Catalog tasks , where request item is ritm , for each , Wait for conditions to close the sctasks , once look up count is 0 , then update the ritm 

It's not working for me even after updating the script. Can you please say what needs to be changed. @Badrinarayan 

 

Thanks,

Tulasi

Screenshot 2025-07-11 at 12.20.59 PM.png

 

 

Run the flow as System User , Use wait for condition in between to wait till the Catalog tasks are closed or not

 

Mark as helpful if your issue is resolved


Thanks regards

Badrinarayan

Ashish Parab
Mega Sage

I will suggest you to utilize your existing flow which you have created for the catalog item.  Use Lookup Records action as below,

AshishParab_0-1752154266159.png

Then use if  -> Lookup Records count is greater than 0 then Update the Request and RITM to closed complete. ( in above lookup records action we are just checking how many closed incomplete or skipped catalog task for our RITM. If count is greater than 0 means there is no any closed incomplete/ skipped task so we are Closed Complete Request and RITM ) 

 

AshishParab_1-1752154350131.png

 

Please mark this response as Correct and Helpful if it assists you.


Thanks,
Ashish

 

@Ashish Parab can you please say where exactly i should give these actions ? 

tulasi8_0-1752205098508.png