Problem with getting "startableByUser" processes

I have a process where neither candateStarterGroups nor candateStarterUsers is defined, e.g.:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns=""
    xmlns:xsi="" xmlns:flowable=""
    xmlns:bpmndi="" xmlns:omgdc=""
    xmlns:omgdi="" typeLanguage=""
    expressionLanguage="" targetNamespace="">
    <process id="my-process">
        <startEvent id="start"/>
        <sequenceFlow id="flow1" sourceRef="start" targetRef="someTask"/>
        <userTask id="someTask" name="Flowable is awesome!"/>
        <sequenceFlow id="flow2" sourceRef="someTask" targetRef="end"/>
        <endEvent id="end"/>

When I’m trying to query process definitions startable by some user, I expect to see this process definition, because it has no restrictions on who can start it.

Unit test:


import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.test.Deployment;
import org.flowable.engine.test.FlowableRule;
import org.junit.Rule;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals;

public class MyUnitTest {

    public FlowableRule flowableRule = new FlowableRule();

    @Deployment(resources = {"my-process.bpmn20.xml"})
    public void test() {
        List<ProcessDefinition> processDefinitions = flowableRule.getRepositoryService().createProcessDefinitionQuery()
        assertEquals(1, processDefinitions.size());

But the query with startableByUser("someUser") condition returns nothing. Such queries return only processes where candidates are explicitly defined. Was it designed this way intentionally or it is a bug? Is there a way to query process definitions where no candidates are defined?


Yes this is by design. When using startableByUser it checks for explicitly defined candidateStarterGroups and candidateStarterUsers.

You can also argue that not defining candidateStarterGroups or candidateStarterUsers means that this is a process definition that should not be started by anyone, perhaps a system process.

Currently there is no way to query process definitions where no candidates are defined. In order to check for that you would need to get the process definition and then you can use RepositoryService#getIdentityLinksForProcessDefinition(String) to get all the identity links for the definition and then check that that is an empty list (no candidates defined).


Hi Filip,
thank you for the answer an for the provided solution.
As I understand, by design, if no candidate is defined that means that this process should not be started by users at all, right?
What are best practices then to specify that this process can be started by any user? To have a separate group which contains all users and automatically add new users to it?

Exactly by design in the Java API it is like that.

Exactly, if you have a base group that all users belong to then you can assign this group to all users and also add new users to it.