# Access to Name of SubNode-Instance

**URL:** <https://discourse.nodered.org/t/access-to-name-of-subnode-instance/90244>\
**Category:** General\
**Tags:** function-node\
**Created:** [18 August 2024 09:20 UTC](https://discourse.nodered.org/t/access-to-name-of-subnode-instance/90244 "2024-08-18T09:20:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![IngoKnito](https://avatars.discourse-cdn.com/v4/letter/i/41988e/32.png) [@IngoKnito](https://discourse.nodered.org/u/IngoKnito)\
**Post date:** [18 August 2024 09:20 UTC](https://discourse.nodered.org/t/access-to-name-of-subnode-instance/90244/1 "2024-08-18T09:20:48Z")

</div>

The basis is a subnode name as “SubFunc” in Node-Red.  
Now the subnode is instantiated and a name “DoSomething01” is assigned to this instance in the UI.  
How can I access the assigned name of this instance in the subnode?

When i use node.name in the subnode i only get "SubFunc".

The usual way of expanding the msg in an additional function node beforehand is not a solution for me.

According to my research, the name of the instance is only saved in the Node-Red UI.

Is this correct or is there a way?

---

<div class="post-metadata">

**Author:** ![GretaC](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@GretaC](https://discourse.nodered.org/u/GretaC)\
**Post date:** [13 October 2024 13:00 UTC](https://discourse.nodered.org/t/access-to-name-of-subnode-instance/90244/2 "2024-10-13T13:00:23Z")

</div>

I think this is what you are looking for:

> let subnodeName = env.get("NR\_SUBFLOW\_NAME");

But you need Node-Red \>= 3.1 (see [here](https://nodered.org/docs/user-guide/environment-variables))

---

<div class="post-metadata">

**Author:** ![IngoKnito](https://avatars.discourse-cdn.com/v4/letter/i/41988e/32.png) [@IngoKnito](https://discourse.nodered.org/u/IngoKnito)\
**Post date:** [13 October 2024 15:13 UTC](https://discourse.nodered.org/t/access-to-name-of-subnode-instance/90244/3 "2024-10-13T15:13:41Z")

</div>

Perfect! That's exactly what I was looking for.

Thank you so much!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 October 2024 15:13 UTC](https://discourse.nodered.org/t/access-to-name-of-subnode-instance/90244/4 "2024-10-27T15:13:47Z")

</div>

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