# Local variable scope with parallel gateway

**URL:** <https://forum.flowable.org/t/local-variable-scope-with-parallel-gateway/5761>\
**Category:** Flowable Engine\
**Created:** [April 2, 2020, 9:53pm UTC](https://forum.flowable.org/t/local-variable-scope-with-parallel-gateway/5761 "2020-04-02T21:53:03Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [April 13, 2020, 10:53am UTC](https://forum.flowable.org/t/local-variable-scope-with-parallel-gateway/5761/5 "2020-04-13T10:53:39Z")

</div>

Setting variables on executions locally will keep those variables around until the execution are cleaned up. This can happen in a variety of places, e.g. because the engine decides to merge executions due to parallel paths being merged. In the example here, this is (most likely) what is happening: at point F, the previous executions are merged.

In your example, you’re saying you use a subproces. But do you also store the variables on the execution related to the subprocess?

An alternative could be store store the variables on the process instance level, but make them unique, see [Multi-Instance and then waiting for the events](https://forum.flowable.org/t/multi-instance-and-then-waiting-for-the-events/5739) for a post where this was done.

---

_[View the full topic](https://forum.flowable.org/t/local-variable-scope-with-parallel-gateway/5761)._
