Flow designer creating 2 tasks one after other but the other flow is closing the RITM.

trinadh2
Giga Guru

Hi,

We have a catalog item which has a flow to create 2 tasks one after the other which is working as expected from flow. the challenge here is we have a flow in flow designer which will run on the SCTASK for all the items to see if there are inactive Tasks close the RITM(this ability was developed because few users create manual tasks). So now for the new catalog item when the first task is completed RITM is setting the state to closed and then the 2nd task is getting created.

 

@Ankur Bawiskar Is there any way to achieve this?

Thanks in advance

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so closing RITM once task is closed should not create new tasks?

the flow linked to catalog item should have no impact on the above update.

regards
Ankur

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

@Ankur Bawiskar 
So Flow should run as per the requirement which means it should create the 2nd task once the 1st one is completed but it shouldn't close the RITM.
The RITM should get closed when the 2nd task is also closed. is there any way that i can use wait for condition?

 

I tried wait for duration 10 seconds which doesn't look good for other items where once the task is closed they have to wait for 10 seconds to see the RITM closed.

 

Hi,

then your logic to close RITM should check if this is the last active task which is getting closed for the current RITM; then only close the RITM

Regards
Ankur

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

@Ankur Bawiskar  thank you for the response. could you please help me to know how to check it? any way to check from the flow designer?

 

I am trying to use this script in the flow designer wait for condition activity 

var gr1 = new GlideRecord('sc_task');
    gr1.addQuery('request_item', fd_data.trigger.table_name.request_item);
    gr1.addEncodedQuery('stateNOT IN3,4,7');
    gr1.query();
    var totalTasksCompleted = gr1.getRowCount();
    if(totalTasksCompleted == 0){
        gs.log('this task count');
        return true;
}
else{
returnfalse;
}