Flow variable only works once

I have a dashboard dropdown setting a flow variable (name) and I am using it to set the email address for a notification. It works the first time it sends an email, after that my name variable clears out (in the context menu) and I get a send failed message in my flow. How can I set the variable and have it stay there until the next name is selected from the dashboard dropdown.

I removed the emails and email node properties from the code below.

[{"id":"cee6b4e8.6b5f38","type":"debug","z":"87fc7610.f11ba8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":260,"wires":[]},{"id":"2748c941.49ba66","type":"ui_dropdown","z":"87fc7610.f11ba8","name":"Machinist List on dashboard","label":"","tooltip":"","place":"Select option","group":"626ca449.4dfd8c","order":0,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"Br J","value":"BJ","type":"str"},{"label":"Be M","value":"BM","type":"str"}],"payload":"","topic":"","x":120,"y":140,"wires":[["e1bc08c5.c4ae38"]]},{"id":"e1bc08c5.c4ae38","type":"change","z":"87fc7610.f11ba8","name":"","rules":[{"t":"set","p":"name","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":140,"wires":[["884d669d.eb3b48"]]},{"id":"884d669d.eb3b48","type":"debug","z":"87fc7610.f11ba8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":100,"wires":[]},{"id":"b3f7e7b4.598278","type":"e-mail","z":"87fc7610.f11ba8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"email node","x":530,"y":340,"wires":[]},{"id":"834e2f72.66192","type":"change","z":"87fc7610.f11ba8","name":"","rules":[{"t":"move","p":"name","pt":"flow","to":"to","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":340,"wires":[["b3f7e7b4.598278","cee6b4e8.6b5f38"]]},{"id":"2b8b351a.6f877a","type":"inject","z":"87fc7610.f11ba8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Still waiting for Cycle Start M0 or M1","payloadType":"str","x":110,"y":340,"wires":[["834e2f72.66192"]]},{"id":"626ca449.4dfd8c","type":"ui_group","name":"Machinist List","tab":"22daeffd.b2613","order":1,"disp":true,"width":"6","collapse":false},{"id":"22daeffd.b2613","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

In the Change node move flow name you are Moving flow.name to msg.to. By using Move that clears the source (which is the flow variable). Use Set msg.to To flow.name instead. That will not affect the flow variable.

1 Like

Thank you. That makes complete sense, something so simple.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.