# Have Objects in msg, need to take actions based on one of the payload codes

**URL:** <https://discourse.nodered.org/t/have-objects-in-msg-need-to-take-actions-based-on-one-of-the-payload-codes/37451>\
**Category:** General\
**Created:** [13 December 2020 19:17 UTC](https://discourse.nodered.org/t/have-objects-in-msg-need-to-take-actions-based-on-one-of-the-payload-codes/37451 "2020-12-13T19:17:45Z")\
**Posts on this page:** 5\
**Page:** 4

<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:** [17 December 2020 15:34 UTC](https://discourse.nodered.org/t/have-objects-in-msg-need-to-take-actions-based-on-one-of-the-payload-codes/37451/63 "2020-12-17T15:34:10Z")

</div>

Yes, the icon does not change, which is a pity, it means you have to click the dropdown to see which one you have selected. You have selected the wrong one.  
The data _is_ getiing written to the file by the second Change node, but the inject node is trying to _read_ it, since you have the wrong context store selected in the inject node it is looking for a variable called switch1 in memory context and there is not one so it is undefined. You could have a flow variable called switch1 in memory context and one of the same name in file context and they would be different. I would advise against doing that however.  
I see that you also have the wrong one selected in the first Change node too. Fix them all and try again. If still not working then post the flow again.

---

<div class="post-metadata">

**Author:** ![Tomadoggy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomadoggy/32/34065_2.png) [@Tomadoggy](https://discourse.nodered.org/u/Tomadoggy)\
**Post date:** [17 December 2020 15:47 UTC](https://discourse.nodered.org/t/have-objects-in-msg-need-to-take-actions-based-on-one-of-the-payload-codes/37451/64 "2020-12-17T15:47:43Z")

</div>

OMG, I am finally getting what you are saying. The data is being written to the file, but you were directing me to have the inject node READ from file and that was set to memory. ID10T move here. All other flow names have been checked, needed no changes that I could see. Very sorry for wasting your time and copious thanks!

---

<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:** [17 December 2020 15:50 UTC](https://discourse.nodered.org/t/have-objects-in-msg-need-to-take-actions-based-on-one-of-the-payload-codes/37451/65 "2020-12-17T15:50:29Z")

</div>

Have you checked them both in the first change node?

---

<div class="post-metadata">

**Author:** ![Tomadoggy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tomadoggy/32/34065_2.png) [@Tomadoggy](https://discourse.nodered.org/u/Tomadoggy)\
**Post date:** [17 December 2020 17:09 UTC](https://discourse.nodered.org/t/have-objects-in-msg-need-to-take-actions-based-on-one-of-the-payload-codes/37451/66 "2020-12-17T17:09:45Z")

</div>

Indeed, still testing...but seems to be working now.

By the way...I am retracting my purported bug issue as it was predicated on the issue resolved above.

---

<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:** [31 December 2020 17:09 UTC](https://discourse.nodered.org/t/have-objects-in-msg-need-to-take-actions-based-on-one-of-the-payload-codes/37451/67 "2020-12-31T17:09:48Z")

</div>

Closed on 31 December 2020 17:09 UTC

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

[Previous page](https://discourse.nodered.org/t/have-objects-in-msg-need-to-take-actions-based-on-one-of-the-payload-codes/37451.md?page=3)
