# Message sends old object

**URL:** https://discourse.nodered.org/t/message-sends-old-object/40210
**Category:** Developing Nodes
**Created:** [2 February 2021 02:20 UTC](https://discourse.nodered.org/t/message-sends-old-object/40210 "2021-02-02T02:20:05Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jeevan900929](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jeevan900929/32/36306_2.png) [@jeevan900929](https://discourse.nodered.org/u/jeevan900929)
#### Post date: [2 February 2021 02:20 UTC](https://discourse.nodered.org/t/message-sends-old-object/40210/1 "2021-02-02T02:20:05Z")

</div>

I have created a node, and within it there is a for loop:  
[https://monosnap.com/file/DPbBhDwZe2cnPglIWujIrVTr5s3eJV](https://monosnap.com/file/DPbBhDwZe2cnPglIWujIrVTr5s3eJV)

Somehow, all the messages in the for loop gets set to the last iteration's message:  
[https://monosnap.com/file/8IrSuLE44wcNTuivGqFu2ebe621tFo](https://monosnap.com/file/8IrSuLE44wcNTuivGqFu2ebe621tFo)

Should I be calling send() in a different way for multiple messages?  
Or maybe I need to create "new objects" so that it doesn't get overwritten. How would I do that.

Thank you in advance.

---

<div class="post-metadata">

### Author: ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)
#### Post date: [2 February 2021 03:35 UTC](https://discourse.nodered.org/t/message-sends-old-object/40210/2 "2021-02-02T03:35:16Z")

</div>

Have you read [Cloning messages in a flow : Node-RED](https://nodered.org/blog/2019/09/13/cloning-messages)

I would guess this may be related to what you are seeing.

---

<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 February 2021 05:39 UTC](https://discourse.nodered.org/t/message-sends-old-object/40210/3 "2021-02-02T05:39:37Z")

</div>

Unfortunately I cant look at the code you posted as i get an access denied.

---

<div class="post-metadata">

### Author: ![jeevan900929](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jeevan900929/32/36306_2.png) [@jeevan900929](https://discourse.nodered.org/u/jeevan900929)
#### Post date: [2 February 2021 06:56 UTC](https://discourse.nodered.org/t/message-sends-old-object/40210/4 "2021-02-02T06:56:10Z")

</div>

Yes, adding RED.util.cloneMessage() did the trick.

Thank you! 😁

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [2 February 2021 08:20 UTC](https://discourse.nodered.org/t/message-sends-old-object/40210/5 "2021-02-02T08:20:37Z")

</div>

For future reference please see this post for how to share code or a flow here - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<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: [16 February 2021 08:21 UTC](https://discourse.nodered.org/t/message-sends-old-object/40210/6 "2021-02-16T08:21:34Z")

</div>

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