“How to reference all items from a previous node (contacts) when the next node isn’t directly connected in n8n?”

Hey, welcome to the community!

I haven’t caught up with your question, but I’ll try to answer based on what I understood. To reference All Items of the previous node you usually use {{ $json }} or something more specific like {{ $json.exampleField }}. However, if the previous node isn’t directly connected to the one you are currently editing, you won’t be able to reference its items. Example:

  • If the flow is: Node ANode B, then you can reference all items of Node A output inside Node B. Even if there was a node in-between(Node ANode CNode B) you would still be able to do so.
  • However, if Node A isn’t directly connected to Node B, then you cannot reference any items of Node A inside Node B.

The connection between nodes is like a path where items are carried. Items must follow the path until they reach the desired destination without any breaks if you want to reference or use them.

As a workaround: use n8n’s built-in Data Table node(or any external database) to store data. Whenever you want to reference an item you simply add Get Rows from a Data Table node just before your destination.