I’m new to n8n. Seems like a great tool and community
I’ve got one problem.
I created something like a root workflow with a decesion engine giving me the ID of the Workflow to be executed. In order to design the “child” workflow, I would like to access data from the root workflow via expression editor. Is that possible?
Hey @Eric, welcome to the community
This would be possible if you pass on the data from the parent to the child. When using the Execute Workflow node, you would need to pass on all data relevant for your child workflow should to it. You could use the Set node for the job
In order to have the data available in the Expression Editor of your child workflow, you’d need to copy it from the parent and then mock it in your child workflow, for example using a Function node running a snippet like this:
You can easily copy data from the JSON view of any node by first selecting this and then using the copy button appearing the upper right corner:
Hope this helps! Give me a shout if you get stuck somewhere!
edit: thanks for the really fast reply.
I didnt get it.
If I understand correctly, your steps describe a manual workaround to test/design the child workflow with the data from the first workflow. Is that correct? Would mean, when the workflow runs automatically later, the data from the root workflow is automatically passed to the start of the child and I would not need the set or function anymore?
Would mean, when the workflow runs automatically later, the data from the root workflow is automatically passed to the start of the child and I would not net the set or function anymore?
Yes, exactly. The Function node in you child workflow is just a workaround here which you can use when building your child workflows.
You can disable it once you have finished building your child workflow. At that time the parent workflow would send “real” data to the child workflow.
ok great and thanks. I will give it a try.
Works like a charm.
One question about the design. I would like to divide workflows into smaller reusable workflows and thus load the corresponding workflow for certain tasks (big workflows).
How does it look here regarding the performance. Does it make sense to copy certain sections again and again when they are used in another workflow or is it perfomance technically identical if I build a kind of function libraray with smaller sections that can be reused.
In my scenario the data flow always remains identical.