Updating node with renamed default keys

Hi everybody,

while updating my custom node I noticed, that some of my default key names are not very accurate.

If I want to set the old value to the new key I have to keep the old key in defaults, otherwise the value is lost on startup (getting value by RED.nodes.node("xx"), while it still remains in the json file.

Is there a way to get the "old" node values without loading the json file separatly? ( I am sure a long time ago (Node-RED 1.x.x) has shown the old keys till deploying.)

I am using the latest version 3.1 currently.

E.g. -> I want to rename "api" to "apiTag" and "api" should be deleted to keep the code clean.


  RED.nodes.registerType('openApi-red', {
    defaults: {
      name: 			    { value: '',  label: 'Name', placeholder: 'openApi-red', icon: 'tag' },
      // apiTag:         { value: '',  label: 'API tag' }, // new key 
      // api: { value: ''}, // old key which should be removed

     // change on startup
    RED.events.on('runtime-state', (msg) => {
    if (msg.state === 'start') {
           RED.nodes.eachNode(node => {
               if (node.type === 'my Node') node.apiTag = node.api

Thanks in advance.

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