Reference Data from Previous Nodes in n8n

Difficulty
2/10
Tags
EssentialsHTTP RequestEdit Fields (Set)ExpressionsJSON

In n8n workflows, data flows from one node to the next. But what if you need data from a node that ran three steps ago? This is called "backwards referencing" and it is essential for building real workflows.

When you open a node's Edit Fields panel, the left sidebar shows incoming data. You can click to select any previous node in the workflow and drag fields directly into your expressions. This lets you combine data from multiple sources without writing complex code.

In this challenge, you will work with a completed workflow that fetches country data and processes it through several nodes. Your task is to configure the final node to pull specific fields from different earlier nodes.

What you'll practice:

  • Selecting previous nodes in the input panel
  • Dragging and dropping fields into expressions
  • Combining data from multiple workflow steps

Your Task

A workflow is provided that fetches country information and processes it through several steps. The final "Create Summary" node is empty.

Configure the "Create Summary" node to output these fields by referencing data from the correct earlier nodes:

  • country_name: The common name from the "Fetch Country Data" node
  • capital_city: The capital from the "Extract Location Info" node
  • population_millions: The calculated population from the "Calculate Stats" node
  • region: The region from the "Extract Location Info" node
  • currency_name: The currency name from the "Extract Currency Info" node

Expected output format:

{
  "country_name": "Germany",
  "capital_city": "Berlin",
  "population_millions": 83.24,
  "region": "Europe",
  "currency_name": "Euro"
}

Key skill: Use the input panel on the left side of the Edit Fields node to select different previous nodes and drag their fields into your output.

Paste into n8n with Ctrl+V

Hints

  1. Click on the "Create Summary" node to open it
  2. Look at the left panel where it says "INPUT" - this shows data from the previous node
  3. Click the dropdown at the top of the input panel to see ALL previous nodes in the workflow
  4. Select "Fetch Country Data" to see the raw API response, then drag name.common into your first field
  5. Select "Extract Location Info" to find capital and region
  6. Select "Calculate Stats" to find population_millions
  7. Select "Extract Currency Info" to find currency_name

How to drag and drop:

  • In the input panel, hover over a field name
  • Drag it to the "Value" input of your Edit Fields assignment
  • n8n automatically creates the correct expression with the node reference

Explanation

Why backwards referencing matters:

Real workflows often need to combine data from multiple steps. For example, you might fetch user data in step 1, look up their company in step 2, and then create a summary that includes both the user name (from step 1) and company name (from step 2). Without backwards referencing, you would need to manually pass every field through every node.

How it works in n8n:

When you select a previous node in the input panel and drag a field, n8n creates an expression like:

{{ $('Node Name').item.json.fieldName }}

The $('Node Name') part tells n8n to look at a specific node's output, regardless of how many nodes are between it and your current node. This is more reliable than chaining $json references through every intermediate step.

The input panel workflow:

  1. Open any node that accepts expressions
  2. Look at the INPUT panel on the left side
  3. Use the dropdown to switch between previous nodes
  4. Each node shows its output data structure
  5. Drag fields directly into your expression inputs
  6. n8n handles the syntax automatically

This drag-and-drop approach prevents typos and ensures you reference the correct node. It is especially valuable in longer workflows where manually typing node names would be error-prone.

Copy the Solution

Click below to copy the solution workflow to your clipboard. Then open n8n and press Ctrl+V anywhere on the canvas to paste it.

Login to see the exercise

Create an account to access challenges and track your progress.

Log in to see exercise