# How to dynamically change candidate groups for current process instance

**URL:** <https://forum.flowable.org/t/how-to-dynamically-change-candidate-groups-for-current-process-instance/5347>\
**Category:** Flowable Engine\
**Created:** [January 31, 2020, 8:54am UTC](https://forum.flowable.org/t/how-to-dynamically-change-candidate-groups-for-current-process-instance/5347 "2020-01-31T08:54:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarkStar1](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/darkstar1/32/394_2.png) [@DarkStar1](https://forum.flowable.org/u/DarkStar1)\
**Post date:** [January 31, 2020, 8:54am UTC](https://forum.flowable.org/t/how-to-dynamically-change-candidate-groups-for-current-process-instance/5347/1 "2020-01-31T08:54:44Z")

</div>

I have defined a process with candidate groups that subscribe to a naming scheme such as **GROUP\_{{execution\_variable}}** and would like to substitute the **{{execution\_variable}}** part for all tasks in the process instance when it is created/started.  
Any suggestions about how I can go about this?  
I was thinking of:  
1 - A process execution listener, but I have seen nothing yet in the api that will allow me to get the user tasks and allow me to modify this, as user tasks are created at the execution points.  
2 - A task execution listener, perhaps, that will fire on start of each task instance; which would mean that I’d have to add this [listener] for every user task in the process definition.

---

<div class="post-metadata">

**Author:** ![wwitt](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/wwitt/32/706_2.png) [@wwitt](https://forum.flowable.org/u/wwitt)\
**Post date:** [January 31, 2020, 12:04pm UTC](https://forum.flowable.org/t/how-to-dynamically-change-candidate-groups-for-current-process-instance/5347/2 "2020-01-31T12:04:39Z")

</div>

You can set the candidate groups to something like `GROUP_${groupVar}`, then setting groupVar to “foo” on the process would set the candidate groups to `GROUP_foo`. But it seems like you want to update the candidate groups on a task that has already been created. In that case, I think you’ll need to work with the task’s identity links.

---

<div class="post-metadata">

**Author:** ![DarkStar1](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/darkstar1/32/394_2.png) [@DarkStar1](https://forum.flowable.org/u/DarkStar1)\
**Post date:** [January 31, 2020, 2:30pm UTC](https://forum.flowable.org/t/how-to-dynamically-change-candidate-groups-for-current-process-instance/5347/3 "2020-01-31T14:30:57Z")

</div>

This seems exactly like what I need, as the variable I need is present prior to process instantiation.  
Will test and reply later.  
**Edit** :  
Thanks. That worked.
