Return the input items that produced the output items... Item Linking?

I have a workflow that retrieves a text document with JSON formatted text. After retrieving, extracting and then data mapping, there’s a note over the output that:

To make sure expressions after this node work, return the input items that produced each output item.

How do I do that? I can’t seem to find clear examples how to remedy this. My actual workflow has additional code nodes but they all say the same thing.

When I use synthetic data from an Edit Fields node I don’t see those alerts downstream.

Information on your n8n setup

  • n8n version: 1.73.1
  • Database (default: SQLite): I believe so!
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): I believe npm? Railway.app
  • Operating system: I’m Mac OS X but the app is running on Railway.app

Hi @ckrkptrck

This is part of using the code node in n8n because it sort of “interrupts” the programmatic data flow of a workflow. In order to keep the data flow linked and for future nodes reference-able you need to link the items via the pairedItem property.

Like so:

return items[0].json.data.map((item, index) => {
  return { json: item, pairedItem: index };
});

If you do not link them you could potentially run into a mapping issue further down the workflow when referencing a node before the code node

Note, this only applies to using the item variable. If you’re working with $input instead, the item linking will be done by n8n under the hood.

1 Like

Perfect! Thank you @ria !

1 Like

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