request item is in progress create the 5 catalog task and assign to 5 different groups

shivanitana
Tera Contributor

request item is in progress create the 5 catalog task and assign to 5 different groups.dont allow RITM & Request to close until all catalog task close please suggest me best approach

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@shivanitana 

so where are you stuck?

-> 5 catalog task creation

OR

-> closure logic
recommendation: After update BR on sc_task and then close RITM and REQ once last sc task is closed

you can use business rule or flow designer for this

BR approach: I shared the script few years ago; check this

How can we close RITM when all the catalog task is closed for that item? 

you can use after update BR on sc_task

Condition: State [IS ONE OF] Closed Complete/Closed Incomplete AND Request Item.Item == Your Catalog Item

Script:

(function executeRule(current, previous /*null when async*/) {



        // Add your code here

        var gr = new GlideRecord('sc_task');

        gr.addQuery('request_item', current.request_item);

        gr.addQuery('active', true);

        gr.query();

        if(!gr.next()){

               var ritm = current.request_item.getRefRecord();

               ritm.state = 3;

               ritm.update();

               var req = ritm.request.getRefRecord();

               req.state = 3;

               req.update();

        }



})(current, previous);

Flow Designer approach: I shared solution few years ago

I have shared solution below using flow designer to close parent INC when all child INCs are closed.

Enhance it for sc_req_item and sc_task table

If all child incident is closed then after Parent incident should be closed. How to achieve through....

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader