Request, RITM and SC Task Correct Closure Process?

VIKAS45
Tera Guru

 

Please consider below 3 scenario and confirm the correct Closure Process.

 

When Request is Closed ,RITM and SCTask should be closed?
When SC Task is Closed ,RITM and Request should be closed?
When RITM is Closed, Request and SCTask should be closed?

8 REPLIES 8

I did it seems that the OOB business rule has been adjusted for closure of the req and ritm based of SC Task state : 

(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();
    }

})(current, previous);

Danish Bhairag2
Tera Sage
Tera Sage

Hi @VIKAS45 ,

 

Its the 2nd one. Task which gets assigned to team are closed first when they are done with their work. Once all task closes under an RITM the RITM gets closed post which the REQ gets close.

 

Thanks,

Danish

 

William Busby
Tera Guru

The closing of a REQ happens automatically when the RITM closes via a business rule. The closing of a RITM is controlled by the workflow or flow reaching the 'Complete' stage, NOT the closure of any catalog tasks. You can test this by creating a flow which creates a catalog task and remove the 'Wait' option of the task. Ensure the end of the flow is assigned the 'Complete' stage and submit a request for your item. Since the flow won't wait for the task closure it'll hit the 'Complete' stage and close the RITM. Then the BR will fire which checks to ensure all the RITM's assigned to the REQ are closed and will close the REQ. Meanwhile your catalog task will be sitting there in an open state while everything else looks like it's closed/fulfilled.

 

If you want to enforce the 'correct' behavior you'll need to make some modifications to include checks for the status of catalog tasks as well.

Marcus Walbridg
Tera Expert

This should cascade from the bottom up because a Request record can have many RITMs, and RITMs can have many SC Tasks.  So it should be something like this:

 

  1. Once all tasks are complete, close RITM
  2. Once all RITMs are complete, close Request

Basically going bottom up