I’d like to create a workflow that performs an atomic unit of work and share it between parent workflows. When calling an automation script from a workflow, I can pass variables to it. Is there any way I can do that with a subworkflow?
I see a scope option, but it’s documented as passing the scope of the subworkflow back up to the parent workflow, and not any scope from the parent workflow down to the subworkflow.
Are there any workarounds, or am I missing something?
I think this is a mistake in the docs. With
scope, you pass the variables into the sub-workflow and with results, you can get them out.
Can you point me to the docs page that has this?
Sorry, it’s not in the documentation, it’s in the workflow help tooltip.
Execute a workflow and map variables from its scope to the current one
Is this description accurate?
I aslo see that you can map results. Is there a difference between the scope mapping and the results mapping? Am I using the results correctly in the image below?
How can we pass data down to the subworkflow?
For sending stuff in the WF: create a variable of type “Vars” and pass it in scope param.
For getting stuff out of the WF: add “result” for each variable in the subwf scope and “copy” it back to the current scope.
I have 2 workflow that you can import and play around with.
It plays the scenario of inputting vars into the sub-workflow and retrieving vars from the sub-workflow and printing it on the main wf.
I hope this helps
Please see attached.
Sub workflows.zip (1.1 KB)
Hey @AndreB ,
I see what you mean. Altough the subworkflow you attached is not importable (the json content is not properly populated as you noted in your github issue ).
@AndreB I saw in a commit message that subworkflow exporting was fixed. Could you please re-export the sub-workflow zips? I could use the sample.
AndreB, thanks for sharing this… It greatly helps me in my project.
Hi please see attached.
This should give you a good idea!
SUBWORKFLOWS.zip (1.8 KB)