# Subflow environment variables

**URL:** <https://discourse.nodered.org/t/subflow-environment-variables/78790>\
**Category:** General\
**Created:** [29 May 2023 16:54 UTC](https://discourse.nodered.org/t/subflow-environment-variables/78790 "2023-05-29T16:54:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [29 May 2023 16:54 UTC](https://discourse.nodered.org/t/subflow-environment-variables/78790/1 "2023-05-29T16:54:20Z")

</div>

how to pass global variables as a property (ENVIRONMENT VARIABLES ) of a subflow in node red

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/7/873136f6f48f7510db01e514d8c22d7a6edf49ed.png)

---

<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:** [29 May 2023 17:01 UTC](https://discourse.nodered.org/t/subflow-environment-variables/78790/2 "2023-05-29T17:01:36Z")

</div>

Why would you need to, all the globals would be available in the subflow anyway.

You could just pass on the name/path of the gloabal you wished to use in the subflow, as a string input.

---

<div class="post-metadata">

**Author:** ![Nadhir](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Nadhir](https://discourse.nodered.org/u/Nadhir)\
**Post date:** [29 May 2023 17:10 UTC](https://discourse.nodered.org/t/subflow-environment-variables/78790/3 "2023-05-29T17:10:44Z")

</div>

I have subflows that are used in an other parts of the project any modification in their internal nodes can modify their fonctionality so entring a global variable , a flow variable ... to the input of env variables would solve the problem and would solve many problems in the future as it allow you to conserve subflows and only change their input

---

<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:** [29 May 2023 17:16 UTC](https://discourse.nodered.org/t/subflow-environment-variables/78790/4 "2023-05-29T17:16:45Z")

</div>

But there is no option for global input.

So as i said you would have to set the global path as string. Then in your subflow use that string to retrieve the global value you required. You will need to edit your subflow template.

---

<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:** [28 July 2023 17:17 UTC](https://discourse.nodered.org/t/subflow-environment-variables/78790/5 "2023-07-28T17:17:31Z")

</div>

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