Accessing Flow Information From Custom Node


I am trying to get the Flow Info within my custom node on input event as follows:

this.on('input', function (msg, nodeSend, nodeDone) {
   + " processing start");
            node.start_time =;
            console.debug("Capturing active flow details - begin");
            const activeWorkspaceId =;
            node.activeflow = RED.nodes.workspace(activeWorkspaceId);
            if (!node.activeflow) {
                // this is probably a subflow
                node.activeSubflow = RED.nodes.subflow(activeWorkspaceId);
            } else {

However I am getting error as follows:

%s - %s 30 Jun 12:07:12 [error] TypeError: Cannot read property 'active' of undefined

Kindly help with this issue.

Regards is part of the editor, i.e. you run on the client-side.

this.on('input') however takes place on the server-side. Luckily your custom node keeps track of where it belongs. node._flow should contain everything you're looking for.

1 Like

What problem are you actually trying to solve here?

Nodes shouldn't care where the input comes from or behave differently depending where they are.

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