# Function with 2 Output

**URL:** https://discourse.nodered.org/t/function-with-2-output/39986
**Category:** Developing Nodes
**Created:** [29 January 2021 07:16 UTC](https://discourse.nodered.org/t/function-with-2-output/39986 "2021-01-29T07:16:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bsailer1975](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@bsailer1975](https://discourse.nodered.org/u/bsailer1975)
#### Post date: [29 January 2021 07:16 UTC](https://discourse.nodered.org/t/function-with-2-output/39986/1 "2021-01-29T07:16:30Z")

</div>

Good morning!

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/b/fb894d7fa43645d49b5c417fa270d0eab23bc56a.png)

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [29 January 2021 07:32 UTC](https://discourse.nodered.org/t/function-with-2-output/39986/2 "2021-01-29T07:32:24Z")

</div>

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](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:

```auto
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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [12 February 2021 07:32 UTC](https://discourse.nodered.org/t/function-with-2-output/39986/3 "2021-02-12T07:32:29Z")

</div>

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