Retrieving status of pre-defined nodes

Good day everyone.

I have looked around and could not find any reasonable solutions (apologies).

What I'm trying to do is try and retrieve the status of each specific nodes in a subflow, and modify the payload message based on what node was outputting a status using a function node.


What I have done so far is modified the actual IDs of nodes using Node-RED's Admin API PUT flow/global

Please see image below, I have modified one node's ID as "node_startrecord"

I want to access "node_startrecord" in a function node such as:


but apparently, the nodeID is different upon deploying the flow.

One important note with what I'm trying to do is, it is necessary to define static IDs for each nodes as the flows I will be creating are used in multiple environment.

Thank you very much!

Can you explain the end goal ? To me it is not entirely clear what you are trying to do and/or if you need to (or can) use a different approach. In this example the subflow looks to be redundant.

Thank you for your response.

The end goal is a bit...complicated.
The basic gist of it is that, an external tool accepts file imports which will then parse that file and create subflows dynamically using Admin API. And in that external tool is where the definition of Node IDs are performed.

So in the end, the only steps that the user will have to perform in Node-RED editor is just to connect subflow nodes

If you tick the 'status node' option on the Subflow toolbar you'll get a status output node inside the subflow. You can use that to control what Status messages are emitted by the Subflow instances. That would be a better way of approaching what you are trying to do. That way a user doesn't need to know anything about the internals of the subflow - they interact with the subflow instance node itself.

also node ids are not fixed - they may change if the flow/subflow is re-imported or moved to a different machine. Relying on them being fixed will be very fragile and will break.

Thank you for your input.

they may change if the flow/subflow is re-imported or moved to a different machine.

This is what I'm trying to achieve, to have a predefined IDs for some identified nodes in a subflow so that whenever the flow and template subflows are re-imported or moved, the user doesn't have to update the function node mentioned above.

Thank you for your response.

I did not mention but the system as a whole comprises of 2 other external components that interfaces with Node-RED.

The purpose of the function node (please see image above) is to "read" the status output and modify the status message based on what node produced said output.

The whole thing is a bit complex and not sure if I could divulge more because of confidentiality reasons.

If referencing static, predefined IDs is impossible to achieve in Node-RED editor, I guess I just have to find another solution :confused:

Why not set the name of the node instead of id?

Can you retrieve the name as output of status node?

I'll give it a try. Thank you.

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