How to Set the Same Flow Variables in a Subflow as in the Main Flow

Soki Ando
Tera Contributor

I have linked multiple subflows to a flow. If anyone knows how to set the same flow variables in a subflow as in the main flow, please let me know.
I’ve specified the Consumer record, which triggers this flow, as the flow variable, so I want to pass the same data to the subflow.

 

Flow

SokiAndo_0-1727237805547.png

 

Subflow

SokiAndo_1-1727237870648.png

 

5 REPLIES 5

Akash4
Kilo Sage
Kilo Sage

Hi Soki,

You need to create input variable first in Subflow then map it to parent Flow variable. Try this way

 

Say variable_test as Flow variable is in Flow and var_test Input variable created in Subflow. Then, under the Inputs section of the subflow, map:
• variable_test from the main flow to the var_test input in the subflow.

 

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

SP22
Mega Sage
Mega Sage

Hello @Soki Ando,

Please find the below link and let me know whether it is useful or not.

https://developer.servicenow.com/dev.do#!/learn/learning-plans/washingtondc/servicenow_application_d...

Thanks
SP

Preethi Tiruma1
Tera Contributor

Hi @Soki Ando ,

1. Create Flow variable first in both Parent Flow and Sub flow.
For your reference I am using Incident Table Here.
In Main Flow:

PreethiTiruma1_21-1727247332242.png

In Sub flow:

PreethiTiruma1_22-1727247390272.png

2. Now create one input variable in Sub flow (Variable 1)

PreethiTiruma1_23-1727247433706.png

3. Update the Parent Flow variable with respective Data. (Using 'Set Flow variables' action)

PreethiTiruma1_24-1727247491979.png

4. Call this Sub flow in Parent Flow and pass the 'Parent Flow Variable' to Subflow.

PreethiTiruma1_27-1727247978375.png

5. Now you passed the Parent flow variable to Sub flow. If you want the Sub flow variable also to be same. Use 'Set Flow Variables' action in Sub flow and update the value with input 'variable1'.

PreethiTiruma1_28-1727247992319.png

 

PreethiTiruma1_29-1727247992322.png

 

Thank you for your detailed response.
At the following step, I am unable to select the "Parent Flow Variable" from the data picker:

4. Call this Subflow in the Parent Flow and pass the 'Parent Flow Variable' to the Subflow.

Do you know why only some fields are selectable?