I really dont know what is happening but I cant find a way to access a variable that I set with edit fields and want to access later… its not passed with every node since there is HTTP calls and switch nodes but how do I fix a variable?
How do I pass global variables that I want to access across the entire workflow? Is this so hard… like wtf?
The oringinal one has sensitive information but I replciated it to show what I mean… it illustrates it perfectly
if you simply remove the HTTP request it works and outputs the variable as manual. As soon as you include it the last code node returns an empty object. This is my basic problem
Very wierd fix, but it does the job if you are very urgent,
Use Workflow Static Data to access variables anywhere in your workflow:
// To save a variable (in any Function node):
await $setWorkflowStaticData("global", {
myVariable: "my value"
});
// To access it anywhere else:
const myVar = await $getWorkflowStaticData("global").myVariable;
This works across all branches, HTTP calls, and switch nodes because it’s stored with the workflow, not passed between nodes.
If my quick solution helps solve your urgent issue, please mark it as the answer!
you set them in your UI(similar to adding a cred), and then I believe you reference them with $vars.<var_name>. I don’t think you need them though, you just need to rework your workflow.
Well if trying to explicitly accessing the node with an expression doesn’t work, that means that the data is not getting to that node. Share your whole workflow json plz
The oringinal one has sensitive information but I replciated it to show what I mean… it illustrates it perfectly
if you simply remove the HTTP request it works and outputs the variable as manual. As soon as you include it the last code node returns an empty object. This is my basic problem
that one doesn’t work either. Cant access it after the HTTP call… isn’t there any way to set this variable globally and access it? Cause its never overwritten, its just accessed to check based on switches