How to get the node object inside the subflow?

Hello,

Node-RED version: v1.3.5-git
Node.js version: v14.15.5

I have a problem when I use subflows. Currently my flow has 151 nodes, counting those inside the subflow.

When the method RED.nodes.eachNode() is executed, it return all 151 nodes.
For each one I need to get the node object so I can add some info into it.
So, I run the method RED.nodes.getNode() passing the node ID.
It works fine for every node inside my main flow.
But for those nodes inside my subflow, they return 'undefined'.
It looks like they are not even loaded.

There is a way to get the node object inside the subflow? Maybe passing the subflow id.

For reference, RED.nodes.eachNode() return:

{
  _id: 60dbaabd71eb2d28107ae06c,
  id: 'd45bf771.5735e8',
  type: 'subflow:8431ba6.5fb9648',
  z: '61da7dd1.760484',
  name: '',
  env: [],
  x: 420,
  y: 1720,
  wires: [ [ 'f639171a.d9f418' ] ]
}

And RED.nodes.getNode() return:

Node {
  id: 'd45bf771.5735e8',
  type: 'subflow:8431ba6.5fb9648',
  z: '61da7dd1.760484',
  _closeCallbacks: [ [Function (anonymous)] ],
  _inputCallback: [Function (anonymous)],
  _inputCallbacks: null,
  wires: [ [ 'fbf91c33.9b8ed' ] ],
  _wireCount: 1,
  send: [Function (anonymous)],
  _wire: 'fbf91c33.9b8ed',
  status: [Function (anonymous)],
  _updateWires: [Function (anonymous)],
  updateWires: [Function (anonymous)]
}

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