# Payload global. or flow

**URL:** https://discourse.nodered.org/t/payload-global-or-flow/47602
**Category:** General
**Created:** [24 June 2021 19:15 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602 "2021-06-24T19:15:01Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![dsplitz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dsplitz/32/49940_2.png) [@dsplitz](https://discourse.nodered.org/u/dsplitz)
#### Post date: [24 June 2021 19:15 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602/1 "2021-06-24T19:15:02Z")

</div>

In many nodes you can select the payload to be global. or flow. ( as well as number, string, buffer....)

Can anyone please point to documentation or examples on how these are used. I've had no lock searching on my own.

Thank you

---

<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: [24 June 2021 19:18 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602/2 "2021-06-24T19:18:43Z")

</div>

What you can actually select in those nodes is to make use of the incoming `msg`, or a _context variable_ which might be a global or a flow variable.

`payload` is part of the incoming msg (it is a convention, it isn't mandated but is commonly used). e.g `msg.payload`.

Global context variables are available across all of your tabs and sub-flows.

Flow variables are available only in the tab that defines them.

---

<div class="post-metadata">

### Author: ![dsplitz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dsplitz/32/49940_2.png) [@dsplitz](https://discourse.nodered.org/u/dsplitz)
#### Post date: [24 June 2021 19:39 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602/3 "2021-06-24T19:39:06Z")

</div>

I'm not sure you understood my question.  
Take for example the ui button node. Under the line "When clicked send" you have options for payload and topic. I've used the other options but global. and flow. are a mystery to me.

---

<div class="post-metadata">

### Author: ![dsplitz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dsplitz/32/49940_2.png) [@dsplitz](https://discourse.nodered.org/u/dsplitz)
#### Post date: [24 June 2021 19:40 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602/4 "2021-06-24T19:40:43Z")

</div>

I guess what I'm hoping is I can directly up a global or flow variable in the payload without having to add a function node.

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [24 June 2021 19:47 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602/5 "2021-06-24T19:47:37Z")

</div>

Like this?  
 ![Untitled 9](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/1/81cb62314395b0b5f85f0755a9a5647359926397.jpeg)  
I suppose if I needed to extract something more difficult from payload - a substring say, I'd use a function node.

---

<div class="post-metadata">

### Author: ![dsplitz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dsplitz/32/49940_2.png) [@dsplitz](https://discourse.nodered.org/u/dsplitz)
#### Post date: [24 June 2021 20:00 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602/6 "2021-06-24T20:00:46Z")

</div>

Like this.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e716e38bc61037ad0275cb1e93af053c88169e7a.png)

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [24 June 2021 20:13 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602/7 "2021-06-24T20:13:59Z")

</div>

Hi @dsplitz

you asked for documentation, so the starting point is the docs on 'Context' - [Working with context : Node-RED](https://nodered.org/docs/user-guide/context)

This is what 'global' and 'flow' refer to - values that exist outside of any one particular message.

So let's say you have, in another flow, set `global.color` to the value `"red"`. You can configure the ui\_button node to send a message with its `payload` property set to the current value of `global.color`. That means you can dynamically change the value the button sends by changing the value in context.

Does that help answer your questions?

---

<div class="post-metadata">

### Author: ![dsplitz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dsplitz/32/49940_2.png) [@dsplitz](https://discourse.nodered.org/u/dsplitz)
#### Post date: [24 June 2021 20:26 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602/8 "2021-06-24T20:26:30Z")

</div>

Awesome!! Thank you that answers it.

Dave

---

<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: [23 August 2021 20:26 UTC](https://discourse.nodered.org/t/payload-global-or-flow/47602/9 "2021-08-23T20:26:50Z")

</div>

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