# Help with how to get around this \*problem\* \`msg.part\`

**URL:** https://discourse.nodered.org/t/help-with-how-to-get-around-this-problem-msg-part/80307
**Category:** General
**Created:** [4 August 2023 01:43 UTC](https://discourse.nodered.org/t/help-with-how-to-get-around-this-problem-msg-part/80307 "2023-08-04T01:43:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [4 August 2023 01:43 UTC](https://discourse.nodered.org/t/help-with-how-to-get-around-this-problem-msg-part/80307/1 "2023-08-04T01:43:26Z")

</div>

For reasons unknown now I have this bit of code in a node:  
`newval = RED.util.getMessageProperty(msg,part)`

I now see there is a problem if the `msg.payload` is simply `true` or `false`.

How can I detect this and avoid using the above line but rather just set `newval` to the message's payload?

---

<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: [4 August 2023 04:07 UTC](https://discourse.nodered.org/t/help-with-how-to-get-around-this-problem-msg-part/80307/2 "2023-08-04T04:07:16Z")

</div>

Test it

```auto
newval = msg.paylod
if (msg.paylod && typeof msg.paylod === "object"){ 
    // msg.paylod is something and is definitely an object 
    newval = RED.util.getMessageProperty(msg,part)
} 

```

---

<div class="post-metadata">

### Author: ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)
#### Post date: [4 August 2023 04:44 UTC](https://discourse.nodered.org/t/help-with-how-to-get-around-this-problem-msg-part/80307/3 "2023-08-04T04:44:55Z")

</div>

> [@Steve-Mcl](#):
>
> `paylod`

?? or payload

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [4 August 2023 05:47 UTC](https://discourse.nodered.org/t/help-with-how-to-get-around-this-problem-msg-part/80307/4 "2023-08-04T05:47:18Z")

</div>

Thanks @Steve-Mcl

That seems to be working.

I read around the typo.

---

<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: [18 August 2023 05:48 UTC](https://discourse.nodered.org/t/help-with-how-to-get-around-this-problem-msg-part/80307/5 "2023-08-18T05:48:09Z")

</div>

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