Store information in workflow variable and context possible?

Describe the problem/error/question

Hello, is there a possibility to store and retrieve additional information in the section Variables and context? I would like to set some data which I use later on in the workflow without putting it into the actual data. My idea is to put some kind of config node at the beginning of the workflow, so I can set various things like file name, storage location etc. only in one node, making it easier for other people not knowing the workflow well later on. If you know if/how that works or have any other ideas on how to resolve this issue, I would be very thankful. Looking forward to your input! Thank you very much!

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: Version 2.7.4
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Windows 11 Enterprise

The most popular approach is to add a Set (Edit) Fields node at the start of your workflow with configuration variables. You can find many templates using this method, because it collects all personal or manually set variables at the beginning of the workflow and makes them available to all other nodes.

1 Like

Hey welcome! That Variables and context panel youre looking at is actually read-only, it just shows execution metadata so you cant store your own stuff there. What you want is an Edit Fields (Set) node right at the start of your workflow where you define all your config values like file name, storage path, etc, as fixed values, then any node downstream can reference them with an expression like {{ $('Config').item.json.fileName }}. Here’s a quick example you can import:

Just edit the values in that Config node and anyone can tweak the settings without touching the rest of the workflow

2 Likes

Thank you for all that info!

How about if the first node is a webhook, where I already receive data I don’t want to modify. How would you solve that? I was thinking about using a second branch, where I just do the config, then refer to it in my workflow. Is this the way to go or do you have any other ideas?

I was thinking about something like that:

Not sure if I understood correctly, but inserting variables into a data table is also an another method that might suit your case. Data tables live inside the n8n instance(built-in feature), so variables stored in there are safe as long as your instance has no security issues; you can reference variables from different workflows or branches in this case.

Data tables can accessed from https://your-instance-url/home/datatables.

2 Likes