# Setting msg.something

**URL:** <https://discourse.nodered.org/t/setting-msg-something/21615>\
**Category:** General\
**Created:** [12 February 2020 20:04 UTC](https://discourse.nodered.org/t/setting-msg-something/21615 "2020-02-12T20:04:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zunder1990](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@zunder1990](https://discourse.nodered.org/u/zunder1990)\
**Post date:** [12 February 2020 20:04 UTC](https://discourse.nodered.org/t/setting-msg-something/21615/1 "2020-02-12T20:04:44Z")

</div>

I am working on making changes to flows that have no be changed or ran since summer if last year. Back then I had heavily made use of msg.something = something in function nodes. I am changing to make to the code but something is working.

Where is like what I have in the node from back then  
msg.TalkID = msg.payload[0].TalkID.toString();  
This would set msg.TalkID to what was returned from mysql.

In testing I have even tried msg.TalkID = 1; and cant not get it to set.

TLDR has something changed in nodered that will not let me set msg.something if so what is the work around.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [12 February 2020 20:12 UTC](https://discourse.nodered.org/t/setting-msg-something/21615/2 "2020-02-12T20:12:11Z")

</div>

Can you paste the code from your `function` node in a reply. Also connect a `debug` node to the output of what ever is feeding the `function` and show us what the msg entering the `function` node looks like.

---

<div class="post-metadata">

**Author:** ![zunder1990](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@zunder1990](https://discourse.nodered.org/u/zunder1990)\
**Post date:** [12 February 2020 20:17 UTC](https://discourse.nodered.org/t/setting-msg-something/21615/3 "2020-02-12T20:17:00Z")

</div>

Here is a sample flow

```auto
[{"id":"7c739125.fa17a8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"627e2c20.b552b4","type":"inject","z":"7c739125.fa17a8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":141,"y":173,"wires":[["7bd9fcda.5c39e4"]]},{"id":"7bd9fcda.5c39e4","type":"function","z":"7c739125.fa17a8","name":"setting var","func":"msg.ID = 1;\nmsg.filename = \"test.mkv\";\nreturn msg;\n","outputs":1,"noerr":0,"x":346,"y":176,"wires":[["8991332.ae6cc5"]]},{"id":"8991332.ae6cc5","type":"debug","z":"7c739125.fa17a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":577.5,"y":173,"wires":[]}]

```

Here is debug  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/e/9e7df5cc58154707935c3517829a847d98b6be00.png)

version 1.0.3 of node red

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [12 February 2020 20:29 UTC](https://discourse.nodered.org/t/setting-msg-something/21615/4 "2020-02-12T20:29:53Z")

</div>

In your flow, you have the debug node set to `msg` only instead of `complete msg object`.  
If I change it to show the `complete msg object`, I see this in the debug sidebar. Is this what you expected to see?  
If not, what did you expect to see?

 ![inject](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6fb7d9cf2e1fc2d534798f87c6ee90eb49242ba8.jpeg)

---

<div class="post-metadata">

**Author:** ![zunder1990](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@zunder1990](https://discourse.nodered.org/u/zunder1990)\
**Post date:** [12 February 2020 20:35 UTC](https://discourse.nodered.org/t/setting-msg-something/21615/5 "2020-02-12T20:35:55Z")

</div>

OMG WTF, I have been pulling my hair out for the past few weeks over this. Thank you for your help

---

<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:** [26 February 2020 20:35 UTC](https://discourse.nodered.org/t/setting-msg-something/21615/6 "2020-02-26T20:35:56Z")

</div>

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