# How to get msg value when configuring node?

**URL:** https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876
**Category:** General
**Created:** [19 October 2019 06:34 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876 "2019-10-19T06:34:07Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![przeqpiciel](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@przeqpiciel](https://discourse.nodered.org/u/przeqpiciel)
#### Post date: [19 October 2019 06:34 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/1 "2019-10-19T06:34:07Z")

</div>

Hi all, it will be my first post, so ... GREETINGS !

I need to know how to read values from msg.payload in nodes' configuration. There is my simple flow

 ![Clipboard01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/9b9b4c0c60cd403e4c802c2ae4458905c3616ccf.jpeg)  
In function node I have very, simple code

```auto
msg.payload = {
    "test": "32",
    "blabla": "15"
};
return msg;

```

And question is. How use msg.payload.blabla in this below configuration field

 ![Clipboard02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/745d7310c038cdd107abcd38d0cfb6dd5459fb9d.jpeg)

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [19 October 2019 07:25 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/2 "2019-10-19T07:25:44Z")

</div>

You haven’t told us what contrib-node you are using.

But next to  
Data there is `🔻{}` does clicking here give you any other options?

---

<div class="post-metadata">

### Author: ![przeqpiciel](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@przeqpiciel](https://discourse.nodered.org/u/przeqpiciel)
#### Post date: [19 October 2019 07:39 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/3 "2019-10-19T07:39:43Z")

</div>

This is the 'call service node' from 'home assistant' pallette. When i click on this button i have that ![Clipboard03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/59d332899e68e7c54721f83681c4a2c13a4d7d0d.jpeg)

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [19 October 2019 08:12 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/4 "2019-10-19T08:12:53Z")

</div>

Unfortunately your description doesn’t help track it down.  
You installed something, most probably called node-red-contrib-XXXXX

If you look on [flows.nodered.org](http://flows.nodered.org) there are 4 with home assistant in the title.  
[https://flows.nodered.org/search?term=home+assistant&type=node](https://flows.nodered.org/search?term=home+assistant&type=node)

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [19 October 2019 09:24 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/5 "2019-10-19T09:24:55Z")

</div>

I think it depends on if the author has written his node to pass `msg` through to the configuration node internals and specifically processes `msg` for that `data` property

In other words, it might not be possible.

In the JSONata expression, you could try....

- Accessing `payload` without `msg.`
- Accessing flow or global context vars (set before call to node)

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [19 October 2019 09:49 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/6 "2019-10-19T09:49:43Z")

</div>

Did A quick search for that node and I think I found the right one.

The source code shows there is help info built in to the config node (open the config node and view the info side bar).

The info says

```auto

    <dt>payload.data<span class="property-type">JSON | string</span></dt>
    <dd>Overrides or sets the data/params property of the config.</dd>

```

So it would seem if you send ...

```auto
msg.payload = {
    "data": {
       "test": 33
    }
};
return msg;

```

You won't need to put anything into the config node `data` field at all (it should pick up the `data` object in `payload` automatically.

Also, reading the source, it is my suspicion the JSONata expression doesn't require `msg.` part to access `payload`.

---

<div class="post-metadata">

### Author: ![przeqpiciel](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@przeqpiciel](https://discourse.nodered.org/u/przeqpiciel)
#### Post date: [19 October 2019 11:09 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/7 "2019-10-19T11:09:32Z")

</div>

You have got right. I modified function node to that and its works

```auto
msg.payload = {
    data: {
        "temperature":"22"
    }
};
return msg;

```

---

<div class="post-metadata">

### Author: ![przeqpiciel](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@przeqpiciel](https://discourse.nodered.org/u/przeqpiciel)
#### Post date: [17 February 2020 14:09 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/8 "2020-02-17T14:09:31Z")

</div>

Hi,

Is it possible to pass multiple entities?

msg.payload = {  
"data":{  
"temperature": 22,  
"entity\_id": (  
"climate.danfoss\_z\_thermostat\_014g0013\_heating\_1\_8",  
"climate.danfoss\_z\_thermostat\_014g0013\_heating\_1\_4"  
)  
}  
}  
return msg;

---

<div class="post-metadata">

### Author: ![przeqpiciel](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@przeqpiciel](https://discourse.nodered.org/u/przeqpiciel)
#### Post date: [17 February 2020 14:13 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/9 "2020-02-17T14:13:56Z")

</div>

Yes, It is possible

> msg.payload = {  
> "data":{  
> "temperature": 10,  
> "entity\_id":  
> "climate.danfoss\_z\_thermostat\_014g0013\_heating\_1\_8, climate.danfoss\_z\_thermostat\_014g0013\_heating\_1\_4"
> 
> ```
> }
> 
> ```
> 
> }  
> return msg;

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [17 February 2020 14:56 UTC](https://discourse.nodered.org/t/how-to-get-msg-value-when-configuring-node/16876/10 "2020-02-17T14:56:35Z")

</div>

Just in case you wanted an array and not one long string for entity\_id

```auto
msg.payload = {
"data":{
"temperature": 10,
"entity_id":[
"climate.danfoss_z_thermostat_014g0013_heating_1_8","climate.danfoss_z_thermostat_014g0013_heating_1_4"
]
}
};
return msg;

```
