Subflow context access - What I was shown isn't working

Original thread

To test this I wrote this flow:

[{"id":"480c6735eef22428","type":"subflow","name":"Subflow 2","info":"","in":[{"x":60,"y":80,"wires":[{"id":"0baab8933b6c881b"}]}],"out":[{"x":340,"y":80,"wires":[{"id":"0baab8933b6c881b","port":0}]}]},{"id":"0baab8933b6c881b","type":"function","z":"480c6735eef22428","name":"","func":"msg.payload = $parent.example;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":200,"y":80,"wires":[[]]},{"id":"bc62956f2461c1bb","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"A","payloadType":"str","x":110,"y":1950,"wires":[["4bc259bbc93e8c1d"]]},{"id":"1da3c7e9fc2e9311","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B","payloadType":"str","x":110,"y":1990,"wires":[["4bc259bbc93e8c1d"]]},{"id":"f9e8ec3151fa7e4b","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":2090,"wires":[["9b854c5131989160"]]},{"id":"4bc259bbc93e8c1d","type":"change","z":"7e987ddf260bdf0d","name":"","rules":[{"t":"set","p":"example","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":1970,"wires":[[]]},{"id":"ed2b683cd58e129f","type":"debug","z":"7e987ddf260bdf0d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":480,"y":2090,"wires":[]},{"id":"9b854c5131989160","type":"subflow:480c6735eef22428","z":"7e987ddf260bdf0d","name":"","x":280,"y":2090,"wires":[["ed2b683cd58e129f"]]}]

I set the value to A and then try the subflow injection and get this error:

ReferenceError: $parent is not defined (line 1, col 15)

Yes, I am missing something.
Could someone explain to me what?
I am sure it did work.

Oh, NR 2.1.4

Stupid me.

flow.get("$parent.example");

Working.

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