Undefined value in edit fields node

Hello,

In a workflow, I store values ​​in an “Edit fields” node at the start of execution. The rest of the workflow runs for about two minutes, and at the end, I retrieve one of the values ​​from that “Edit fields” node. The problem is that I get an “undefined” message for the field —almost as if the stored value has a limited lifespan.

€# Information on your n8n setup

  • n8n version: 2.29.9
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux Fedora

Hey! Values don’t expire in n8n, so that’s not it.

The real issue is you’re probably losing the reference across branches or after a merge. Try changing your expression to:

{{ $('Edit Fields').first().json.yourField }}

.first() forces n8n to always grab from the original output no matter where you are in the workflow. That fixes it most of the time!

Hi @flipflip
If a Wait node is pausing the run for those two minutes, that is what produces the undefined: n8n saves the execution when it hits the wait and reloads it on resume, so a back-reference like $('Edit Fields').item to a node from before the wait does not reliably survive the reload. The Wait node passes its input straight through, so carry the field on the item instead of reaching back across the wait. Turn on Include Other Input Fields in the Edit Fields node so the value travels with the items into the Wait node, then read it after the wait with:

{{ $json.yourField }}

Hi, thank’s for your response.

Here is a simplified version of my workflow. The “setVar” node is instantiated at the beginning without errors. The workflow runs smoothly, and it is only at the final node that I need the “mail” value specified in “setVar”. The two nodes preceding “setVar” are included solely for illustrative purposes.

Error

Problem in node ‘Send an Email‘

No recipients defined

Hi @flipflip
In the Send an Email node you have {{ $('setVar').first().item.json.mail }}. .first() already returns the item, so chaining .item onto it resolves to undefined, toEmail ends up empty and the node reports “No recipients defined”. Drop the .item:

{{ $('setVar').first().json.mail }}

If it still comes back empty, the address never landed in setVar: its mail assignment reads {{ $json.mail }} off getMail, so open setVar’s output and confirm the field actually holds the address there.

Perfect, thank you.