How to pass variable values from workflow to Flow designer and subflow

anvitha ash
Tera Contributor

Hello community 

 

I have workflow and flow designer flow and subflow, all three are related to a catalog item. Main flow is workflow 

 

1. I want to pass variable values from workflow to Flow and subflow in flow designer. Is there any way where using which we can pass variable values from workflow to Flow? 

2.How to invoke flow and subflow using the workflow?

 

Thanks in advance 😃 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@anvitha ash 

you can invoke flow, subflow using run script activity in workflow and pass the inputs to subflow

Scripting with Flows, Subflows, and Actions 

How to call Flows using Scripts 

Also you can open your subflow and use Create code snippet and it will tell you how to invoke it

AnkurBawiskar_0-1737098410940.png

 

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

9 REPLIES 9

@anvitha ash 

you can't pass inputs to flow via script

You can pass input to subflow via script

So do whatever you wish to do in subflow itself.

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

@anvitha ash 

Hope you are doing good.

Did my reply answer your question?

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

Hi @Ankur Bawiskar 

 

I am invoking a sub flow synchronously from workflow run script activity, however it is not waiting at the run script activity till the sub flow completes and it going to the next steps. Is there a way to stop the run script activity till the sub flow completes?


 

@Girish12 

can you post a new question and share all the details there as this is an old thread?

also tag me there

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

Amit Verma
Kilo Patron
Kilo Patron

Hi @anvitha ash 

 

You need to make use of Run Script activity in your workflow and call the subsequent flow/subflow via Flow API. You can make use of Create Code Snippet functionality as shown below to get the code generated for calling the flow or sub-flow.

AmitVerma_0-1737105834809.png

 

AmitVerma_1-1737105895935.png

 

Use the above code to call your flow inside the workflow activity.

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.