# Newbie storing msg.payload

**URL:** <https://discourse.nodered.org/t/newbie-storing-msg-payload/26709>\
**Category:** General\
**Created:** [15 May 2020 16:35 UTC](https://discourse.nodered.org/t/newbie-storing-msg-payload/26709 "2020-05-15T16:35:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)\
**Post date:** [15 May 2020 16:35 UTC](https://discourse.nodered.org/t/newbie-storing-msg-payload/26709/1 "2020-05-15T16:35:47Z")

</div>

Hello All.  
newbie here, trying to understand nodered.

I have a msg.payload that I need to save for later use.  
Meanwhile I need to perform some processess that change the msg.payload.  
After them I need to recover again the first msg.payload to mix some values from first msg.payload and last msg.payload.  
I am unable to figure out how to do this.  
I tried to store in variable, do a context.set and a context.get but nothing work for me.

Do you have some suggestions on how to do this?  
Thank you in advance and best regards.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [15 May 2020 16:37 UTC](https://discourse.nodered.org/t/newbie-storing-msg-payload/26709/2 "2020-05-15T16:37:22Z")

</div>

Check the [documentation: working with context](https://nodered.org/docs/user-guide/).  
In the context section read about "Using content in a flow".

---

<div class="post-metadata">

**Author:** ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)\
**Post date:** [15 May 2020 16:53 UTC](https://discourse.nodered.org/t/newbie-storing-msg-payload/26709/3 "2020-05-15T16:53:08Z")

</div>

Very fast and this is 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:** [15 May 2020 20:45 UTC](https://discourse.nodered.org/t/newbie-storing-msg-payload/26709/4 "2020-05-15T20:45:18Z")

</div>

If you only need to save it so that you can use it later down the flow then you can copy it to a different attribute of the message. Most nodes will not (and generally should not) change attributes that they don't use, so the value should still be there when you need it later on. So in your case you could use a Change node to Set msg.payloadSaved to msg.payload, then later on down the flow when you want to use it then it should still be there in msg.payloadSaved for you to extract the data you need.

---

<div class="post-metadata">

**Author:** ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)\
**Post date:** [16 May 2020 09:55 UTC](https://discourse.nodered.org/t/newbie-storing-msg-payload/26709/5 "2020-05-16T09:55:58Z")

</div>

Good option too.  
thank you

---

<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:** [30 May 2020 09:55 UTC](https://discourse.nodered.org/t/newbie-storing-msg-payload/26709/6 "2020-05-30T09:55:58Z")

</div>

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