Cannot display flow.set/flow.get message

Hi everyone,

I have an email input node and I want to save the value stored in flow.set and then display it with flow.get

image

Function 1
var email1 = msg.payload;
flow.set('email1',msg.payload);
return msg;

Function 2
var email = flow.get('email1');
msg.payload = email;
return msg;

In the debug node I get nothing.

Thank you very much!

Best regards!

If that is a true copy of your flow, then you are not triggering 'function 2'.

What happens if you connect an 'inject' node to the input of 'function 2' ?
Do you get an output on the 'debug' node ?

Try this...

[{"id":"f7434e0fe255a944","type":"tab","label":"Flow 40","disabled":false,"info":"","env":[]},{"id":"0ef24cb1879073c4","type":"inject","z":"f7434e0fe255a944","name":"Hello world","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello world","payloadType":"str","x":140,"y":200,"wires":[["4e473167bd41c73b"]]},{"id":"4e473167bd41c73b","type":"function","z":"f7434e0fe255a944","name":"","func":"var email1 = msg.payload;\nflow.set('email1',msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":200,"wires":[[]]},{"id":"b384a8d14ca8cb1d","type":"function","z":"f7434e0fe255a944","name":"","func":"var email = flow.get('email1');\nmsg.payload = email;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":200,"wires":[["5fd0b731ab3f2068"]]},{"id":"9824b5929c569b24","type":"inject","z":"f7434e0fe255a944","name":"Trigger","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":370,"y":300,"wires":[["b384a8d14ca8cb1d"]]},{"id":"5fd0b731ab3f2068","type":"debug","z":"f7434e0fe255a944","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":750,"y":200,"wires":[]},{"id":"712de50c1794b28e","type":"comment","z":"f7434e0fe255a944","name":"This simulates an email msg","info":"","x":180,"y":160,"wires":[]}]
1 Like

What happens if you connect and 'inject' node to the input of 'function 2' ?

Does not collect the information

Do you get an output on the 'debug' node ?

It does not show anything at the exit either

I think I've got it right but it doesn't work....

Thank you very much!

Try my small demo flow and see if that works for you.
It works for me.

You could simplify 'function 1' to this...

flow.set('email1',msg.payload);
return msg;
1 Like

It works perfectly your flow!

Why can't it work for me? (input email address)

Can you post your flow so I can check how you have configured your 'ui-text button' ?

Not that it will affect your flow, but a 'change' node could have been used instead of the function nodes.

a_email4

[{"id":"f7434e0fe255a944","type":"tab","label":"Flow 40","disabled":false,"info":"","env":[]},{"id":"0ef24cb1879073c4","type":"inject","z":"f7434e0fe255a944","name":"Hello world","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello world","payloadType":"str","x":140,"y":200,"wires":[["7f755a7cc0db0ec1"]]},{"id":"9824b5929c569b24","type":"inject","z":"f7434e0fe255a944","name":"Trigger","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":130,"y":280,"wires":[["346df4e3ea83ad40"]]},{"id":"5fd0b731ab3f2068","type":"debug","z":"f7434e0fe255a944","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":280,"wires":[]},{"id":"712de50c1794b28e","type":"comment","z":"f7434e0fe255a944","name":"This simulates an email msg","info":"","x":180,"y":160,"wires":[]},{"id":"7f755a7cc0db0ec1","type":"change","z":"f7434e0fe255a944","name":"","rules":[{"t":"set","p":"email1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":200,"wires":[[]]},{"id":"346df4e3ea83ad40","type":"change","z":"f7434e0fe255a944","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"email1","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":280,"wires":[["5fd0b731ab3f2068"]]}]
1 Like

flow.set('email1',msg.payload);
return msg;

That's what I did at first, I tried to do it

here is the configuration of the node

How do I save set msg.payload to take it to a function?

Thank you very much!

What happens if you change the Delay to 0 (zero) ??

a_change

Note: You will need to press 'Enter' or 'Tab' key to send the email address from the Dashboard.

I suggest you put a Debug node on the output of the Text-Button node to see what is happening.

It might speed things up if you could publish your flow.

1 Like

The node to store in a function does not work...

Can I do it differently?

@Loveflowersx one thing to note is that the text-input node is going to send what ever is in the input every 300ms (the default value. This means if you. have a slow typer, you will see bits the text sent as time goes on.

In this case, you might want to use the ui-form node and set an entry as type 'E-mail', then the address will not be sent until the user presses 'SUBMIT'

Please export your flow and post it to a response.

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

That's it, let's hope it works

[{"id":"a5eee90555714331","type":"ui_text_input","z":"af10894d6d33f212","name":"","label":"","tooltip":"","group":"67130af5b364f54e","order":1,"width":"13","height":"1","passthru":true,"mode":"email","delay":"0","topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":150,"y":240,"wires":[["581da0ca3c17659b"]]},{"id":"d1968963fb7a6232","type":"function","z":"af10894d6d33f212","name":"","func":"flow.set('email1',msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":240,"wires":[[]]},{"id":"39c43c54aa86e524","type":"function","z":"af10894d6d33f212","name":"","func":"var email = flow.get('email1');\nmsg.payload = email;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":340,"wires":[["69107c7747380e68"]]},{"id":"69107c7747380e68","type":"debug","z":"af10894d6d33f212","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":750,"y":340,"wires":[]},{"id":"581da0ca3c17659b","type":"rbe","z":"af10894d6d33f212","name":"","func":"rbei","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":290,"y":240,"wires":[["d1968963fb7a6232"]]},{"id":"67130af5b364f54e","type":"ui_group","name":"input_alarmas","tab":"704425028e49e41f","order":1,"disp":false,"width":"25","collapse":false,"className":""},{"id":"704425028e49e41f","type":"ui_tab","name":"ALARMS","icon":"dashboard","order":2,"disabled":false,"hidden":true}]

Thank you very much!

a couple of things

  1. why do you have a filter node in your flow
  2. you might want to use the ui-form node and set an entry as type 'E-mail', then the address will not be sent until the user presses 'SUBMIT'
  3. the second part of your flow will never run since there is no input sent to it.
  1. I was simply testing it.

  2. I want to create several flow.get to take them to a function with a to: here I would insert several variables to send several mails. From the dashboard several input address nodes and put the ones you want.

  3. I think you say the debug node, it is to see if it is sent.

When trying to solve an issue, it is a good idea to add debug nodes in your flow. With the flow you provided, if you add a debug node to the output of the filter node, you will see that nothing is returned the first time.

The second flow will NEVER work without you sending something to the input of that function node. Add an inject node and connect it to the input of the function node, deploy and press the inject button and see what happens.

I'm not sure what you mean by this.

So the flow you have just posted is NOT the same as the original one in this thread.

It would have saved a lot of time if you had posted the correct flow!!

As @zenofmud said, the 'filter' node is causing the problem at the moment, as well as no input to trigger 'function 2' node.

My request:

From dashboard put 2/3 text input nodes (mode: email addres), enter the email or emails and immediately save them in a flow.set and then take them to a function with a flow.get and those that have been set send several mails the same.

What I don't understand is why it doesn't save the value in the flow.set.

Thank you very much for everything

It was just a one-off thing, I don't think it will affect anything. I already made a node with a filter and it worked perfectly.

Sorry if it was too much trouble

Best regards

1 Like

The text input node doesn't work, I think, I try it and nothing...