# UI builder accessing msg.payload object

**URL:** <https://discourse.nodered.org/t/ui-builder-accessing-msg-payload-object/24725>\
**Category:** General\
**Created:** [12 April 2020 23:01 UTC](https://discourse.nodered.org/t/ui-builder-accessing-msg-payload-object/24725 "2020-04-12T23:01:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beefy\_carrot](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@Beefy\_carrot](https://discourse.nodered.org/u/Beefy_carrot)\
**Post date:** [12 April 2020 23:01 UTC](https://discourse.nodered.org/t/ui-builder-accessing-msg-payload-object/24725/1 "2020-04-12T23:01:00Z")

</div>

Can anyone explain how adding the msg.payload object to a variable works in ui builder. i read through the documenation and code, and i still hae no idea.

---

<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:** [13 April 2020 06:11 UTC](https://discourse.nodered.org/t/ui-builder-accessing-msg-payload-object/24725/2 "2020-04-13T06:11:46Z")

</div>

I made a [very simple template](https://gist.github.com/bakman2/8e8232f144c7ac34d4dbbd08cd9fc97b) that reduces the noise.

Using that template, define your variables here:

```auto
data: {
		msg: '',
	},

```

When a msg arrives, you can assign it here:

```auto
uibuilder.onChange('msg', function(msg) {
			vueApp.msg = msg;
		});

```

eg if you define `temperature` in data and you receive a msg `msg.payload.temperature`, you can use `vueApp.temperature = msg.payload.temperature`

---

<div class="post-metadata">

**Author:** ![Beefy\_carrot](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@Beefy\_carrot](https://discourse.nodered.org/u/Beefy_carrot)\
**Post date:** [13 April 2020 20:03 UTC](https://discourse.nodered.org/t/ui-builder-accessing-msg-payload-object/24725/3 "2020-04-13T20:03:15Z")

</div>

Hey! thanks alot 🙂 a bit better with out the noice yea.

---

<div class="post-metadata">

**Author:** ![OmarDev](https://avatars.discourse-cdn.com/v4/letter/o/a88e57/32.png) [@OmarDev](https://discourse.nodered.org/u/OmarDev)\
**Post date:** [3 May 2020 14:17 UTC](https://discourse.nodered.org/t/ui-builder-accessing-msg-payload-object/24725/4 "2020-05-03T14:17:12Z")

</div>

hey, can u please give me this example

---

<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:** [3 May 2020 15:14 UTC](https://discourse.nodered.org/t/ui-builder-accessing-msg-payload-object/24725/5 "2020-05-03T15:14:27Z")

</div>

Click the link in the post 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:** [2 July 2020 15:14 UTC](https://discourse.nodered.org/t/ui-builder-accessing-msg-payload-object/24725/6 "2020-07-02T15:14:28Z")

</div>

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