Changing global variables in a JS function

Hi guys,

I’m trying to include some extra functionality in my workflows, but I’m not finding a lot of ways to act on a device-independent state of the system. Using global variables could be a way to come around this, but they are not so easily managed. Above all they are workflow-specific, and they cannot be viewed or edited through a dashboard (to my knowledge). I’m trying to figure out the best way to do this, maybe I should create a new device to keep states.

A specific problem I’m experiencing now is that I can’t seem to mutate the values of global variables in JavaScript ‘function’ blocks in my workflows. What’s the best way to do this?

Without knowing much about your use case, our best recommendation is to use Store Value and Get Value nodes. These allow you to set a value during a workflow run and use that value in a subsequent run. We think of workflow globals as constants – things such as third-party API credentials and other values that should never change between runs.

Please let us know if those two nodes provide the functionality you’re looking for!

Hey,

Thanks for pointing out how global variables were intended. I was probably right thinking this was not the way to go :wink: Store and Get may be just fine here, I’ll see how far it takes me. Thanks again!