I’m running n8n on docker (from a Synology NAS).
First of all, thank you so much for your hard work. I’m really enjoying using n8n, it gave me a lot of ideas to put in motion. I’m not much of a devoloper, but now this makes it easier to accomplish what I want to do.
To simplify:
I have a workflow, that should check if a user exists in a database. (Let’s call this Workflow U)
I have another workflow, that should register a record in a database IF the user exists. (Let’s call this Workflow A). This is triggered by a webhook.
This should work like… Workflow A → (Workflow U) → MySQL
Is this possible?
How should I setup the Workflow B? It says I can’t activate unless I have a trigger.
Can I send data to Workflow U and get it back?
Welcome to the community @ZXS! Great to hear that you enjoy n8n!
About your question. Yes you can one workflow from another with the “Execute Workflow” node:
Guess what you describe now as Workflow B is this: Workflow A -> (Workflow U) -> MySQL
How should I setup the Workflow B? It says I can’t activate unless I have a trigger.
Yes, that can not be activated as the workflow itself does not have a trigger. You would have to “move” the trigger (in thise case the Webhook-Node) from Workflow A to workflow B.
Can I send data to Workflow U and get it back?
Yes, that is how the “Execute Workflow” node behaves by default.
The “Workflow B” was meant to be “Workflow U”, in my op. Sorry about the confusion.
I’m not sure I understand “moving” the Webhook. The entry Workflow (in my case, i referenced it as Workflow A) also needs a webhook-node. Should I set both with webhook-nodes?
However, I haven’t figured out something. To activate the worflow, we need to have a trigger. In my case, I used a webhook trigger. But when we use the “Execute Workflow”, the starting point is not the trigger, but the Start-node (which makes sense, sure). Why force a workflow to have a trigger?
This allowd the wf to be called internally or via webhook. However, this was not working, because the mysql-node needs to grab something from the previous node. It was specifically getting from the Webhook-node like so: {{$node["Webhook"].json["headers"]["yadayada"]}}, but of course, if it was called internally, the previous node is the Start-node.
Is there a way to grab the “previous”-node? If not, to make this available to both webhook trigger and via “Execute Workflow”-node, do I need an node inbetween to test where the data comes from?
For now, I just removed the link between the webhook and the mysql-node, and changed the variable to use the start-node data, as I don’t need this specific node to use webhook, but I’m interested in this as I might have a use case for it.
Simply creating another node before the “Get User” one (like a NoOp) node which simply does not do anything and then reference the values from that one.