# Shared subflow context

**URL:** <https://discourse.nodered.org/t/shared-subflow-context/3596>\
**Category:** Feature Requests\
**Created:** [1 October 2018 20:34 UTC](https://discourse.nodered.org/t/shared-subflow-context/3596 "2018-10-01T20:34:52Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![adesjardins](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@adesjardins](https://discourse.nodered.org/u/adesjardins)\
**Post date:** [8 November 2018 14:18 UTC](https://discourse.nodered.org/t/shared-subflow-context/3596/9 "2018-11-08T14:18:16Z")

</div>

I think I was not clear at first.

- I don't ask for a flow and a subflow to share the flow context.
- I don't ask for a subflow to share his flow context with other subflows.

It would be a new context called... **static\_subflow**.

It's like static variables of a class X. If you instaciate multiple time the class X, they will all have their own private properties, but they also share static variables. I'd like to see to same for subflows.

All instances of a subflow would have their own flow context, not shared. But they would have a static\_subflow context that would be shared for all intances of the same subflow.

I'd like my subflow to stores configs that are requested from the db. Now I have to store these configs into global or to repeat the same request in each subflows. It's not optimal. With a static\_subflow context, I'd do a request to the database once, eg: pulling configs, then I would pass them to any instance of the subflow into msg.config. Then the sublfow detect it and store it into static\_sublow. Each instances of the same subflow now have access to the same config. No need to repeat SQL request, no need to pass the same msg.config each time. No need to store anything into global. Cleaner, faster and less confusing !

Thanks

_Sorry for my english_

---

_[View the full topic](https://discourse.nodered.org/t/shared-subflow-context/3596)._
