Node id from within a subflow

The debug window shows the id of the debug node that produced the output, except when it's inside a subflow. In this case it shows the id of the subflow instance (the calling node).

Within a function node, node.id returns the id of the node. If the function is inside a subflow, it would be useful to be able to return the id of the calling node. Along the lines of node.parent.id, where parent was only non-null for subflows. Logically it would also extend to node.parent.parent.id for subflows within subflows. Note that this is different to using the $parent context, which is at the flow level.

My use case is for logging within a subflow that is used in multiple flows, to know which node called the subflow. I have many flows and each calls the subflow many times, so using $parent.name doesn't give me enough information and $parent.id doesn't exist (and would logically be the flow id anyway).

Although it adds boilerplate, you could add the needed source information to the msg before entering the subflow as a workaround. Or alternatively add a field to the subflow instance containing the source. Both of these workarounds would need manual maintenance so not ideal of course.

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