Node.id in a subflow

Guys,

I am looking for a node in a subflow to be able to get information about down stream nodes (outside of the subflow). To do this I am retrieving the node.id of a function node and then attempting to match that with data that has been retrieved via the admin API

[{"id":"9fdc928d.df1278","type":"subflow","name":"UIBuilder","info":"","category":"","in":[{"x":50,"y":30,"wires":[{"id":"a7e2bc7b.9ddc78"}]}],"out":[{"x":440,"y":40,"wires":[{"id":"a7e2bc7b.9ddc78","port":0}]},{"x":440,"y":100,"wires":[{"id":"ba91f5c2.fdfa9","port":0}]},{"x":440,"y":200,"wires":[{"id":"a7e2bc7b.9ddc78","port":1}]}],"env":[{"name":"TYPE","type":"str","value":"TestBuilder"}],"color":"#DDAA99","inputLabels":["Up stream flow and Testbuilder"],"outputLabels":["To UI Element","To Testbuilder","To UI Element out"]},{"id":"a7e2bc7b.9ddc78","type":"switch","z":"9fdc928d.df1278","name":"FINDME","property":"testbuilder","propertyType":"msg","rules":[{"t":"null"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":130,"y":160,"wires":[["ba91f5c2.fdfa9"],[]]},{"id":"ba91f5c2.fdfa9","type":"function","z":"9fdc928d.df1278","name":"","func":"id = node.id\n\nlet flows = global.get(\"flows\")\nlet local = flows.filter(elm => elm.id == id )\nlet targets = flows.filter(elm => elm.type.substring(0,8) == \"subflow:\")\n\nmsg.payload = targets\nmsg.local = local\nmsg.id = id\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":140,"wires":[[]]},{"id":"76daedd0.91978c","type":"function","z":"232a5ba8.40f134","name":"No subflow","func":"id = node.id\n\nlet flows = global.get(\"flows\")\nlet local = flows.filter(elm => elm.id == id )\nlet targets = flows.filter(elm => elm.type.substring(0,8) == \"subflow:\")\n\nmsg.payload = targets\nmsg.local = local\nmsg.id = id\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":810,"y":820,"wires":[["89b53ca.799bdc"]]},{"id":"89b53ca.799bdc","type":"debug","z":"232a5ba8.40f134","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":820,"wires":[]},{"id":"441f6a5f.20d80c","type":"inject","z":"232a5ba8.40f134","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":630,"y":820,"wires":[["76daedd0.91978c"]]},{"id":"6c9f154b.9b4854","type":"ui_button","z":"232a5ba8.40f134","name":"FINDME","group":"2b0407f5.237138","order":4,"width":0,"height":0,"passthru":false,"label":"First group","tooltip":"","color":"","bgcolor":"green","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":1000,"y":900,"wires":[["be956e6c.50c498"]]},{"id":"293285e1.79d962","type":"inject","z":"232a5ba8.40f134","name":"FINDME","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":620,"y":940,"wires":[["3316959a.c4c74a"]]},{"id":"3316959a.c4c74a","type":"subflow:9fdc928d.df1278","z":"232a5ba8.40f134","name":"FINDME","env":[{"name":"ui_name","value":"STUFF","type":"str"}],"x":800,"y":940,"wires":[["6c9f154b.9b4854"],["a5ea1d83.5a03d8"],[]]},{"id":"be956e6c.50c498","type":"debug","z":"232a5ba8.40f134","name":"FINDME","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1190,"y":940,"wires":[]},{"id":"a5ea1d83.5a03d8","type":"debug","z":"232a5ba8.40f134","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":990,"y":960,"wires":[]},{"id":"5157681e.5c25d8","type":"inject","z":"232a5ba8.40f134","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":630,"y":760,"wires":[["6815710b.32feb"]]},{"id":"6815710b.32feb","type":"http request","z":"232a5ba8.40f134","name":"flows","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://localhost:1880/flows","tls":"","persist":false,"proxy":"","authType":"","x":790,"y":760,"wires":[["d8572f01.6a7978"]]},{"id":"d8572f01.6a7978","type":"change","z":"232a5ba8.40f134","name":"","rules":[{"t":"set","p":"flows","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":760,"wires":[[]]},{"id":"2b0407f5.237138","type":"ui_group","z":"","name":"First group","tab":"1e24552a.a5441b","order":1,"disp":true,"width":"6","collapse":false},{"id":"1e24552a.a5441b","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

When I run the function outside the subflow the node id retrieved in the function node matches the admin API however when I execute the same function within a subflow the node.id retrieved does not match the id from the ADMIN API. Is this a feature, or am I doing something silly.

I understand I can define an environment variable and use that to map to the subflow to an instance however I would prefer zero config option.

Thanks

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