Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Calling flow from workflow

pramodkumar
Tera Expert

Hi All,

I am using below script to call a flow from workflow which is working as expected. How can add a wait for condition in workflow till flow is completed?

 

(function() {

    try {
        var inputs = {};
        inputs['table_name'] = 'sc_req_item';
        inputs['request_item'] = current; // GlideRecord of table: sc_req_item 

        // Start Asynchronously: Uncomment to run in background.
        // sn_fd.FlowAPI.getRunner().flow('global.test').inBackground().withInputs(inputs).run();

        // Execute Synchronously: Run in foreground.
        sn_fd.FlowAPI.getRunner().flow('global.test').inForeground().withInputs(inputs).run();

    } catch (ex) {
        var message = ex.getMessage();
        gs.error(message);
    }

})();

Thanks!

1 REPLY 1

Najmuddin Mohd
Mega Sage

Hi @pramodkumar ,

Does using Execute Synchronously does not wait till the entire flow is completed.

I thought Execute Asynchronously will start the flow in Background and continue to next and Execute Synchronously will wait till the flow is completed. 

No ?


Regards,
Najmuddin.