# Using Candidate Starter Groups for processes

**URL:** <https://forum.flowable.org/t/using-candidate-starter-groups-for-processes/3769>\
**Category:** Flowable Engine\
**Created:** [April 20, 2019, 7:57pm UTC](https://forum.flowable.org/t/using-candidate-starter-groups-for-processes/3769 "2019-04-20T19:57:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dandoucet](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@Dandoucet](https://forum.flowable.org/u/Dandoucet)\
**Post date:** [April 20, 2019, 7:57pm UTC](https://forum.flowable.org/t/using-candidate-starter-groups-for-processes/3769/1 "2019-04-20T19:57:08Z")

</div>

I’m having trouble dynamically specifying a CandidateStarterGroup to a deployed process definition.

I’ve successfully added a candidate starter user and then used a ProcessDefinitionQuery to list all processes startable by that user as follows:

> ```
> repositoryService.addCandidateStarterUser("holidayRequest:1:3", "dan");
> 
> ```

```
   List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
		   .deploymentId(deployment.getId())
		   .startableByUser("dan")
		   .list();
  
   for (int i=0; i<processDefinitions.size(); i++) {
	   System.out.println((i+1) + ") " + processDefinitions.get(i).getName());
	 }

```

Now I’d like to use `addCandidateStarterGroup` in order to specify a group of users who can start a particular process and issue a similar query. I can’t seem to find the corresponding `.startableByGroup("some group")` on the `ProcessDefinitionQuery` object. Are Candidate Starter Groups queried or used differently?

> addCandidateStarterGroup(String processDefinitionId, String groupId)  
> Authorizes a candidate group for a process definition.

The bigger picture here is that I’d like to be able to deploy a process to a downstream environment (i.e. QA, UAT, PROD) and have the ability to configure who can access a process using the groups defined on the target environment.

Thanks,  
Dan

---

<div class="post-metadata">

**Author:** ![tijs](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tijs](https://forum.flowable.org/u/tijs)\
**Post date:** [April 24, 2019, 7:17am UTC](https://forum.flowable.org/t/using-candidate-starter-groups-for-processes/3769/2 "2019-04-24T07:17:12Z")

</div>

Hi Dan,

The support is done by setting the startableByUser property in the process definition query. This will fetch the groups of this user automatically through this code:

> <https://github.com/flowable/flowable-engine/blob/eeebfd23af3571741b60e3f663f17c0ecc50a812/modules/flowable-engine/src/main/java/org/flowable/engine/impl/ProcessDefinitionQueryImpl.java#L307>

By adding your own implementation of the CandidateManager to the process engine configuration you can fetch the groups of the user in your security environment. Then it will also match against the candidate starter groups of the process definition.

Best regards,

Tijs

---

<div class="post-metadata">

**Author:** ![Dandoucet](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@Dandoucet](https://forum.flowable.org/u/Dandoucet)\
**Post date:** [April 24, 2019, 3:04pm UTC](https://forum.flowable.org/t/using-candidate-starter-groups-for-processes/3769/3 "2019-04-24T15:04:08Z")

</div>

Thanks for the clarification and the pointer to the code. I was thinking of it afterwards and figured it may be implemented in this way (i.e. driven completely of the user’s identity rather than directly querying for a given group). Good to know how to implement.
