Function with 2 Output

Good morning!

Has anyone an idea why i dont get any output on channel 2 of the "Action after... - function"?

Hello
How to send messages or multiple messages to different outputs of the function node is explained here in the docs:
https://nodered.org/docs/user-guide/writing-functions#multiple-messages
In short you need to return an array of msg objects or null for the output index you don’t want to send to. Here is an example for a function with three outputs, it would send the original msg object to output 1, nothing to output 2 and a new object to output 3:

const msg1 = {payload:"another msg object"}; //define a second msg object
return [msg, null, msg1]; //return original to 1, nothing to 2 and msg1 to 3

Johannes

1 Like

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