if SC task sill open - request Item closed

Kishor Mudhili
Giga Guru

hello friends,

 

we have created Flow to create one SC Task, but customers adding multiple Sctasks to the requests.

 

if they closed any SCtask, automatically it's related RITM got closed, it should not happend because when all SCTasks are completed then Related RITM/REQ should be closed, 

i think it should be possible via BR, but not sure how I can 🙂

please help me how we can reproduce the issue. 

 

KishorMudhili_0-1669205919796.png

 

3 ACCEPTED SOLUTIONS

Hello,

 

Can you open the script tracer and then while you closing the sc task start it and then close the task this will give use the list of scripts running during that process. Also make sure your flow is inactive.

 

Saurav11_0-1669213630476.png

 

View solution in original post

if we removed the update conditions from Flow. it won't work . i have restored again then it's working ...

View solution in original post

Hello,

 

Yes that is because you are closing the RITM once the main sctask in the flow. Once you have created it let the RITM close through BR and not the flow remove that last step of closing the RITM if task is closed.

 

Please mark my answer as correct based on Impact.

View solution in original post

18 REPLIES 18

I'm not sure about other Scripts running or not.

flow still active state ... just now i have tried it but no luck .

want to inform to you.

first SC Task will automatically generated when request created.

remain SC tasks manual i have added under request item

Hello,

 

Can you open the script tracer and then while you closing the sc task start it and then close the task this will give use the list of scripts running during that process. Also make sure your flow is inactive.

 

Saurav11_0-1669213630476.png

 

Saurav you are right.. other scripts are running same time :):)

AnubhavRitolia
Mega Sage
Mega Sage

Hi @Kishor Mudhili 

 

I can notice that in your Flow designer only in Step 5 and 6, you can Making RITM as Completed if your SCTASK is Closed Complete. Please remove it from your Flow.

 

Now to close RITM when all related SC Task are closed, you can right below After Update Business Rule:

 

var sctask= new GlideRecord('sc_task');
sctask.addQuery('request_item', current.request_item);
sctask.addEncodedQuery("stateIN-5,1,2");
sctask.query();

if(!sctask.hasNext())
{
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id', current.request_item);
ritm.query();

if(ritm.next())
{
rq.state = 3;
rq.update();
}
}

 

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023