How can we check if all the catalog tasks are closed in flow designer using Wait for condition action

Vidya Shree
Kilo Sage

Hi All, 

How can we check if the approvals are either approved or rejected and all the catalog tasks are closed completed or closed cancelled in flow designer? We need to wait till all the approvals are either approved or rejected before moving future in flow designer

 

Thanks in advance 

Vidya Shree

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi 

try the follow approach. After passing all approval step iterate over the child task and wait until each task is inactive

 

find_real_file.png

Kind regards

Maik

View solution in original post

7 REPLIES 7

emmar00
Tera Contributor

I just walked through the above process. In the data pill picker, there should be a Catalog Task Record under the For Each. This is what you want. It will also populate Table to Catalog Task [sc_task].

 

@Maik Skoddow  I have No action for Record update in the Flow designer, But my request is getting closed when one of the Sc_task is getting closed. Where can i place the wait for conditions before the catalog task creation or after the task creation in flow designer. I am creating two task in the flow designer after the approval is approved.

shloke04
Kilo Patron

Hi,

Please follow below steps to achieve your requirement:

1) You can make use of Action "Wait for Condition" and use the script below for reference which checks for any Approval in Requested state or not and also at the same time checks for any Catalog Task present in Closed complete state or not:

/*
**Access Flow/Action data using the fd_data object. Script must return a value.
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
**
**Requires GlideRecord encodedQuery response, example:
**"active=true^short_descriptionSTARTSWITHtest";
*/

var getRITM  = fd_data.trigger.current.sys_id;
var checkApproval = checkApprovals(getRITM);
var checkTask = checkCatalogTask(getRITM);
var ans;
var ans1;
function checkApprovals(getRITM){
    var app = new GlideRecord('sysapproval_approver');
    app.addQuery('sysapproval',getRITM);
    app.query();
    while(app.next()){
        if(app.state == 'requested'){
            ans = true;
        }else{
            ans = false;
        }
    }
    return ans;
}

function checkCatalogTask(getRITM){
    var gr1 = new GlideRecord('sc_task');
    gr1.addquery('request_item',getRITM);
    gr1.query();
    while(gr1.next()){
        if(gr1.state == 'Put your value of Close Complete here' || gr1.state =='Put your other value to check'){
            ans1 = true;
        }else{
            ans1 = false;
        }
        return ans1;
    }
    if(checkApproval == true || checkTask == true){
        return true;
    }else{
        return false;
    }
}

 

Sample Flow for reference attached below where I am having an approval and also a Catalog task and then using the Wait for Condition :

find_real_file.png

 

find_real_file.png

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke