How to pass inputs from wrofklow to subflow in flow designer

anvitha ash
Tera Contributor

 

Hello,

I have a workflow where I store variable values from RITM variables.

For example, let's say I have a catalog item called ABC. Once the request is submitted, I store some variable values from the RITM of that item, like:

var aa = current.variables.xyz;  
var bb = current.variables.abc;  

Now, I am invoking a Subflow (Flow Designer) using a Run Script activity, and I need to pass the variables aa and bb to the Subflow. These variables need to be used within the Subflow to determine the next steps.

Can someone please guide me on how to pass workflow variables into a Subflow?

Thanks in advance 🙂 


1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@anvitha ash 

something like this

try {
    var aa = current.variables.xyz;
    var bb = current.variables.abc;
    var inputs = {};
    inputs['inputVariable1'] = aa;
    inputs['inputVariable2'] = bb;
    var result = sn_fd.FlowAPI.getRunner().subflow('subflowName').inBackground().withInputs(inputs).run();
    var outputs = result.getOutputs();

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

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

View solution in original post

5 REPLIES 5

@anvitha ash 

you can run the flow in foreground so that you get the flow completed and then only next line will work

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