# Node Creation oneditprepare

**URL:** <https://discourse.nodered.org/t/node-creation-oneditprepare/72840>\
**Category:** Developing Nodes\
**Created:** [28 December 2022 15:50 UTC](https://discourse.nodered.org/t/node-creation-oneditprepare/72840 "2022-12-28T15:50:29Z")\
**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:** [28 December 2022 16:36 UTC](https://discourse.nodered.org/t/node-creation-oneditprepare/72840/2 "2022-12-28T16:36:40Z")

</div>

> [@Flachmann](#):
>
> Where and how do I have to store the new type, so that it remains? NR stores the value automatically, but not the changed type.

This should also be stored automatically for you. Perhaps you are setting this manually?

> [@Flachmann](#):
>
> I guess I have to perform the data interpretation myself.

There are helper functions to do this: [RED.util.evaluateNodeProperty](https://nodered.org/docs/api/modules/v/1.3/@node-red_util_util.html#.evaluateNodeProperty)

e.g...

```auto
function myNode(config) {
    RED.nodes.createNode(this, config)
    const node = this
    node.inField = config.inField || "payload"
    node.inFieldType = config.inFieldType || "msg"

    node.on('input', function (msg) {
        let inField
        RED.util.evaluateNodeProperty(node.inField, node.inFieldType, node, msg, (err, value) => {
            if (err) {
                node.error("Unable to evaluate inField", msg)
                node.status({ fill: "red", shape: "ring", text: "Unable to evaluate inField" })
                return//halt flow!
            } else {
                inField = value
            }
        })
        // do stuff with inField
    })
}
RED.nodes.registerType("myNode", myNode)

```

> [@Flachmann](#):
>
> Are there examples how to do this?

[https://nodered.org/docs/api/ui/typedInput/#examples](https://nodered.org/docs/api/ui/typedInput/#examples)

---

_[View the full topic](https://discourse.nodered.org/t/node-creation-oneditprepare/72840)._
