Global/Flow Variable Access in Custom Node?


#1

I was using globalContext.get("myVariable") in my custom node in order to read my application global variable, but that syntax is not working.

What is the correct syntax to access my Global variable within my node.js file?

Thanks...


#2

global.get("myvar")


#3

That does not work from inside the node.


#4

https://nodered.org/docs/creating-nodes/context


#5

Yeah, I was a bit confused, but added to the node.js file ```
var globalContext = this.context().global;

then, globalContext.get("myVal")

:grinning: