# Smarter programming with subflow and sensors

**URL:** <https://discourse.nodered.org/t/smarter-programming-with-subflow-and-sensors/95945>\
**Category:** General\
**Tags:** function-node, mqtt\
**Created:** [12 March 2025 13:04 UTC](https://discourse.nodered.org/t/smarter-programming-with-subflow-and-sensors/95945 "2025-03-12T13:04:50Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [12 March 2025 13:43 UTC](https://discourse.nodered.org/t/smarter-programming-with-subflow-and-sensors/95945/2 "2025-03-12T13:43:17Z")

</div>

Assuming the env value always exactly matches the property names in the payload, you can use

```auto
const prop = env.get('sensor')
indata = RED.util.getObjectProperty(msg.payload,prop);
...

```

* * *

PS: About your post formatting:

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

_[View the full topic](https://discourse.nodered.org/t/smarter-programming-with-subflow-and-sensors/95945)._
