Questions on using previous nodes' output and sending output to two different nodes

Hey there people! I am having some questions on using output of a node after a set of nodes and also on sending data from webhook to two different nodes at the same time in a single workflow.

Regarding using data from previous nodes

Pls refer to the workflow below. Here, the workflow is running till the second IF node. After that, I cannot get the previous nodes’ data to use in creating a new table and adding rows in Postgres.

The basic thing is, I receive a string (Session ID) from the webhook. I am using that to create a table in Postgres and insert values later.

Inputs from the webhook node look like this

The binary files:

The text data (including the Session ID):

I’m using this information to run the workflow until the OpenAI node without issues. After that, I am not able to refer the values from the previous nodes to use them further. The error is -

(This is taken from the Postgres node.)

How to go about this? I tried using a merge node and could not get which node to attach in the 1st input and use the data properly. Also, will the workflow take a different branch directly to the Merge node/different node?

My workflow

Regarding sending output data to multiple nodes

I tried creating the node in the below structure to overcome the issue above. Still couldn’t get it to work. So, I used a different workflow to call a new webhook which creates the tables separately. That worked for creation. But, later on I need that Session ID to use in inserting rows in Postgres.

So, how will this work?

In this, will the webhook send data to both the branches and both gets executed at the same time, everytime the webhook is called?

Also, if this is possible, can I implement something like this?

How does branching work if we do not have a node like IF or Switch?

I would appreciate any help in this regard.

Information on your n8n setup

  • n8n version: 0.230.3
  • Database: Postgres
  • n8n EXECUTIONS_PROCESS setting: own
  • Running n8n via: Docker
  • Operating system: Ubuntu Server 22.04 LTS

Hi @Jayavel, the expression your are using $('Node name').item... uses what is called “item linking” (previously known as paired items). This is a technique in n8n to determine which item is the source for the currently processed item. Unfortunately it is not supported by all nodes.

In such cases you could consider fetching the linked data before the problematic node (for example using a Set node), then running the problematic node, and finally using a Merge node to combine both the incoming item and the result of the problematic node. Like so:

In this example, the “Fetch linked data” step including the expression takes place before running the node not supporting linked data. After the “Do something else” node, I am then using the Merge node to bring back the linked data.


This works. I tried using it in my workflow, but I am in need to using multiple Merge nodes to pass on the variable to different places. But, it works. Thank you for the example.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.