Variable set outside a loop is inaccessible

My HTTP request needs a session token in the body to authenticate.
The session token is in $node[“Init”].data[“session”]

On the first iteration, everything works fine. On the second iteration, the session token isn’t there. How can I set a variable thats accessible everywhere?

The problem is the small green number you see in the corner of the nodes. Nodes use always the data of the same iteration. So if a node executions the first time it uses the data of the first iteration of the previous nodes. If a node gets executed the second time, it uses the data of the second iteration of the previous nodes. In this case, does the node outside of the loop only execute once. So if you access the data outside of the loop it will not find any, as the node does not have a second iteration.

So the only way to make that work is to either move the init-node into the loop itself or keep on passing it around through the flow.

2 Likes