# Add new entry on msg

**URL:** <https://discourse.nodered.org/t/add-new-entry-on-msg/29832>\
**Category:** General\
**Created:** [10 July 2020 08:05 UTC](https://discourse.nodered.org/t/add-new-entry-on-msg/29832 "2020-07-10T08:05:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rex](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rex/32/59848_2.png) [@rex](https://discourse.nodered.org/u/rex)\
**Post date:** [10 July 2020 08:06 UTC](https://discourse.nodered.org/t/add-new-entry-on-msg/29832/1 "2020-07-10T08:06:00Z")

</div>

I think is a stupid error but this flow does not work. I've already used this function but now, in this example, it does not do the job.

```auto
[{"id":"266afe29.6f9e82","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"bdbdb8e2.66f7d8","type":"inject","z":"266afe29.6f9e82","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":120,"wires":[["e961c946.c39c6"]]},{"id":"e961c946.c39c6","type":"function","z":"266afe29.6f9e82","name":"Add data","func":"msg.payload[\"measure\"] = 123;\nmsg.payload[\"hex\"] = \"0x\";\nmsg.payload[\"empty\"] = {};\n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":120,"wires":[["ed667d93.b8f6f8"]]},{"id":"ed667d93.b8f6f8","type":"debug","z":"266afe29.6f9e82","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":520,"y":120,"wires":[]}]

```

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/777fcd61512125022675fa436112dccfdc8d21d7.png)

Where is my mistake?

Thanks

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [10 July 2020 08:09 UTC](https://discourse.nodered.org/t/add-new-entry-on-msg/29832/2 "2020-07-10T08:09:56Z")

</div>

In the inject node, you've added the default payload which is a timestamp (long integer).

In your function node, you tried to treat that as an object to add properties too.

You can add `msg.payload = {}` at the top of your function or change the inject node to make the payload a json object.

This isn't a stupid mistake but is a common beginners mistake and one that I still make from timet-to-time even after all these years. 😄

---

<div class="post-metadata">

**Author:** ![rex](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rex/32/59848_2.png) [@rex](https://discourse.nodered.org/u/rex)\
**Post date:** [10 July 2020 08:50 UTC](https://discourse.nodered.org/t/add-new-entry-on-msg/29832/3 "2020-07-10T08:50:21Z")

</div>

Thank you for a quick reply, it's a clear explanation.

---

<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:** [24 July 2020 08:50 UTC](https://discourse.nodered.org/t/add-new-entry-on-msg/29832/4 "2020-07-24T08:50:31Z")

</div>

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