A Global variable node/feature

The idea is:

A Global variable node whose data can be manipulated from other nodes especially from the newly introduced Code node

My use case:

In several instances we require to use a variable to store dynamic data, that can be destroyed once the workflow execution finishes.

I think it would be beneficial to add this because:

This feature was working fine until version 0.198 was introduced with the new code node.

Any resources to support this?

Are you willing to work on this?

yes

Hi @Roney_Dsilva

I do not understand the idea. Do you want a node that can be manipulated from the code node?
Or simply a node that can store and retrieve data in/from the global variables?

Hey @Roney_Dsilva,

I like the idea of a node but can’t this already be done with Static data?

Hi @BramKn,
I would like a node that can be used to define a global variable similar to the Set node, and utilize the Code node to add or remove values from it. ex: an array defined, and then you update/push items to that array after performing certain functions in the code node and at the end of the workflow you retrieve the updated array/variable data.

This functionality used to exist in versions earlier than 0.198, in the function node itself, but after the introduction of the code node, it’s broken.

you may refer to the other topic which I raised where this has already been discussed.

OK so it is 2 things you are talking about.
Like @Jon said we got static data for that. But if it is not working anymore in the code node, this should get fixed. I have faith they will soon.

The second is a node to do the same but more user-friendly.

Correct?

Correct!. @BramKn

I have what I think is another use case for this.

I want to report what our workflows are doing. I have configured Google Workplace so I can send to a Google Sheets document. The workflow I’m working on is modular. I have a “controlling” flow that runs other flows and processes the return data. I want a report from the flow when it’s done.

Where this comes in, I want to create the document in the control workflow, but I want the called workflows to be able to write to the same document. It may be a different sheet within that document.

To do so, I need to be able to pass the document ID to each flow when it gets called. If the controlling flow could put that document ID in a variable that any called workflow had access, this would be easy.

I developed a community node for n8n, named n8n-nodes-globals, that potentially offers the features you need. This node enables the establishment of constant variables applicable throughout all workflows. Additionally, it permits the alteration of values in various sets without impacting current nodes.

Usage example:

Please test this node and share your experiences or suggestions.

Github repo: GitHub - umanamente/n8n-nodes-globals: N8N community node that allows users to create global constants and use them in all their workflows

3 Likes

How to automate this? I want to update every day new token value to token variable. And get on every scenaros where i need get.

I found this today that allows you to store variables inside n8n and reference them from other executions or workflows. It works great!

2 Likes