# Environment variable in subflow name?

**URL:** <https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902>\
**Category:** General\
**Tags:** subflow\
**Created:** [10 March 2025 10:19 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902 "2025-03-10T10:19:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ktw/32/99379_2.png) [@ktw](https://discourse.nodered.org/u/ktw)\
**Post date:** [10 March 2025 10:19 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/1 "2025-03-10T10:19:31Z")

</div>

Hi.

Is it possible to use an environment variable in a subflow name, to display the current selection?  
Or is there a better way of doing this?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [10 March 2025 20:15 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/2 "2025-03-10T20:15:28Z")

</div>

Hi and welcome to the forum

short answer, I believe not.

Your question are very vague and would require more information to give a better response.

> [@ktw](#):
>
> to display the current selection?

What is the selection?

> [@ktw](#):
>
> is there a better way of doing this?

What is "this" ?

You may wish to use the status node output to display the information [Subflows : Node-RED](https://nodered.org/docs/user-guide/editor/workspace/subflows#status-node). You can then display thr env var in the status.

Otherwise please supply a better explanation of what you are try to do.

---

<div class="post-metadata">

**Author:** ![ThingsTinkerer](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@ThingsTinkerer](https://discourse.nodered.org/u/ThingsTinkerer)\
**Post date:** [11 March 2025 11:49 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/3 "2025-03-11T11:49:16Z")

</div>

I have seen several nodes which if not having a name use default name, and this can change depending on configuration. It is very nice, for example when using inject node, to have the default name show some info about the configuration (for example the value of payload in case of the inject). It also shows a nice repeat symbol if you have enabled that. It's something I'd like to be able to configure with subflows for example.

---

<div class="post-metadata">

**Author:** ![ktw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ktw/32/99379_2.png) [@ktw](https://discourse.nodered.org/u/ktw)\
**Post date:** [12 March 2025 06:41 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/4 "2025-03-12T06:41:49Z")

</div>

Exactly what I meant.  
Then we could display the name like this: "Subflow name ${ENV\_VAR}"

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 March 2025 06:52 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/5 "2025-03-12T06:52:31Z")

</div>

No. Composite values are not possible in regular text boxes

> This only works if it replaces the entire property - it cannot be used to substitute just part of the value. For example, it is not possible to use CLIENT-${HOST}.

Ref: [Using environment variables : Node-RED](https://nodered.org/docs/user-guide/environment-variables)

---

<div class="post-metadata">

**Author:** ![ThingsTinkerer](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@ThingsTinkerer](https://discourse.nodered.org/u/ThingsTinkerer)\
**Post date:** [12 March 2025 08:32 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/6 "2025-03-12T08:32:38Z")

</div>

Do you know why? I used a similar, older low-code system that was java-based, and it accepted composite values almost everywhere.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 March 2025 09:07 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/7 "2025-03-12T09:07:38Z")

</div>

I can only speculate but likely technical and legacy reasons that were considered during implementation (I believe env var substitution in _any field_ was introduced later and considerations on impact would have been made).

Also, going forwards, all nodes should really use the typed input which DOES support composite values.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 March 2025 09:37 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/8 "2025-03-12T09:37:25Z")

</div>

> [@Steve-Mcl](#):
>
> all nodes should really use the typed input which DOES support composite values.

I don't think that would work for the Name field, which is a fixed value displayed in the Editor.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 March 2025 10:47 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/9 "2025-03-12T10:47:22Z")

</div>

correct. i was being rather general/generic here (for brevity)

---

<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:** [10 June 2025 10:48 UTC](https://discourse.nodered.org/t/environment-variable-in-subflow-name/95902/10 "2025-06-10T10:48:16Z")

</div>

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