RITM not closed despite cancelled SCTASK

mathewirene
Tera Contributor

Hello,

There is a incident raised stating that the RITM was raised for a hardware category . That catalog item had a workflow of creating two SCTASKS. Here the issue one SCTASK got closed complete and later which created another sctask which was also closed skipped state. Even when both the SCTASKS are closed the RITM still is in open state. Hence user wants  to know why RITM is still active . How and where can i check this. How to troubleshoot this. Which all parameters should i check on this to investigate.

 

Thanks

 

7 REPLIES 7

@Viraj Hudlikar  

 

Thankyou for your guidence.The issue can be associated with flow. But the problem is i need to find the root cause for the issue. When i checke previous requests raised under this catalog item , it works fine. How can i investigate the right cause of the issue here. Where all should i check it for?

 

Shashank_Jain
Kilo Sage

@mathewirene ,

You need to add the steps to close the RITM in the workflow being used.

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

SunilKumar_P
Giga Sage

Hi @mathewirene You can create a After Update Business Rule on SCTASK with the below script, which will actually checkfor any active SCTASKs while closing any task. If there are no active tasks then the RITM will be closed.

    var ritmGR = new GlideRecord('sc_req_item');
    if (ritmGR.get(current.request_item)) {

        var scTaskGr = new GlideAggregate('sc_task');
        scTaskGr.addQuery('request_item', ritmGR.getUniqueValue());
        scTaskGr.addQuery('sys_id', '!=', current.getUniqueValue());
        scTaskGr.addActiveQuery();
        scTaskGr.addAggregate('COUNT');
        scTaskGr.query();

        var scTaskCount = 0;
        if (scTaskGr.next()) {
            scTaskCount = scTaskGr.getAggregate('COUNT');
        }

        if (scTaskCount == 0) {
            ritmGR.state = 3;
            ritmGR.update();
        }
    }