# Sending msg object from a switch to more than one node

**URL:** <https://discourse.nodered.org/t/sending-msg-object-from-a-switch-to-more-than-one-node/24082>\
**Category:** General\
**Created:** [2 April 2020 10:05 UTC](https://discourse.nodered.org/t/sending-msg-object-from-a-switch-to-more-than-one-node/24082 "2020-04-02T10:05:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![r0ller](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/r0ller/32/14327_2.png) [@r0ller](https://discourse.nodered.org/u/r0ller)\
**Post date:** [2 April 2020 10:05 UTC](https://discourse.nodered.org/t/sending-msg-object-from-a-switch-to-more-than-one-node/24082/1 "2020-04-02T10:05:11Z")

</div>

Hi All,

I hoped to find an already existing discussion about this but I haven't found any. The case is pretty simple: I'd like to send the output (1 single msg object) of a function node through a certain case of a switch to two other function nodes. However, only one of the target nodes gets the msg object. Is that by design? What would be the "right" way to do it?

Best regards,  
r0ller

PS: Sorry, I had to edit the inital topic as I forgot to mention the switch in between...

---

<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:** [2 April 2020 10:16 UTC](https://discourse.nodered.org/t/sending-msg-object-from-a-switch-to-more-than-one-node/24082/2 "2020-04-02T10:16:16Z")

</div>

can you please lease post your example flow?  
Because it definitely should work. Here is an example and its output:

```auto
[{"id":"11ee8cec.8d0383","type":"inject","z":"f954564f.03e718","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1320,"y":3380,"wires":[["97f67fb5.23e3f"]]},{"id":"97f67fb5.23e3f","type":"function","z":"f954564f.03e718","name":"testobject","func":"msg.payload = {\n test1:\"this is\",\n test2:\" a test\",\n test3:true\n};\nreturn msg;","outputs":1,"noerr":0,"x":1480,"y":3380,"wires":[["31f9668e.cb6a7a"]]},{"id":"31f9668e.cb6a7a","type":"switch","z":"f954564f.03e718","name":"","property":"payload.test3","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1630,"y":3380,"wires":[["4dba2c7b.7e6e9c","4d30bdd2.f6ff4c"]]},{"id":"4dba2c7b.7e6e9c","type":"debug","z":"f954564f.03e718","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.test1","targetType":"msg","x":1850,"y":3360,"wires":[]},{"id":"4d30bdd2.f6ff4c","type":"debug","z":"f954564f.03e718","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.test2","targetType":"msg","x":1850,"y":3400,"wires":[]}]

```

 ![Screenshot 2020-04-02 at 12.14.37](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/9/c917a4d5d2eaa10df069bbdccc729f6bcbfb0e46.png)  
Johannes

---

<div class="post-metadata">

**Author:** ![r0ller](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/r0ller/32/14327_2.png) [@r0ller](https://discourse.nodered.org/u/r0ller)\
**Post date:** [2 April 2020 10:19 UTC](https://discourse.nodered.org/t/sending-msg-object-from-a-switch-to-more-than-one-node/24082/3 "2020-04-02T10:19:09Z")

</div>

Thanks for the quick reply! I just wanted to close this as I realized this to be a picnic. The flow was too complicated to see the root cause. So after creating a minimal example, I realized what the problem is and there's definitely no problem with sending the msg to multiple nodes. Thanks again and sorry for the noise!

---

<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:** [2 April 2020 10:20 UTC](https://discourse.nodered.org/t/sending-msg-object-from-a-switch-to-more-than-one-node/24082/4 "2020-04-02T10:20:34Z")

</div>

No worries.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 April 2020 10:22 UTC](https://discourse.nodered.org/t/sending-msg-object-from-a-switch-to-more-than-one-node/24082/5 "2020-04-02T10:22:11Z")

</div>


