how to check state of an flow when completed and error caught

Raviteja Kunal1
Tera Expert

Hi All

 

I am trying to trigger an sub flow from UI action. How to get status of the sub flow if it is completed or completed (with caught error). I need this information to process further. 

 

Thank you in advance.

var result = {};
    result['condition'] = 'test';

    var gst = sn_fd.FlowAPI.getRunner()
        .subflow('retrieve_supplier_details')
        .inBackground()
        .withInputs(result)
        .run();

 

10 REPLIES 10

@Raviteja Kunal1 

did you print the outputs?

Is the subflow getting triggered? did you verify that?

gs.addInfoMessage(' integration inprogress....');

var inputs = {};
inputs['condition'] = 'sys_id=' + current.getUniqueValue();

var result = sn_fd.FlowAPI.getRunner().subflow('retrieve_supplier_details').inForeground().withInputs(inputs).run();

var outputs = result.getOutputs();

gs.info('outputs is' + outputs);

action.setRedirectURL(current);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

yes it is updating record after sub flow is triggered when any errors causing issue as we need to log those errors

@Raviteja Kunal1 

you can query sys_flow_context table with the flow name and see the state is error

did you try to give something wrong in subflow purposely and use try catch block to know if it throws any error?

Thank you for marking my response as helpful.

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

@Raviteja Kunal1 

did you try using try catch block as per what I mentioned earlier?

 

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

Raviteja Kunal1
Tera Expert

yes but no error message.