How to get a process candidate start group by processDefinitionKey?

I can start a process by the procKey.
I think the internal is get the latest procDefId then create by procDefId?
so the user need not to care about the procDefId.

        ProcessInstanceWithVariables processInstance = runtimeService
                .createProcessInstanceByKey(key)
                .processDefinitionTenantId(user.getTenantId())
                //.businessKey(businessKey)
                .setVariables(vars)
                .executeWithVariablesInReturn();

But when i want to check the role of the use before start proc. I only find the api that is retrive by procDefId.
is there any way to retrive by procKey?

repositoryService.getProcessDefinition(procDefId);

and the query is also have no api to query by candidate start group, how to query by candidate start group?

repositoryService.getProcessDefinition();

the processDefinition object is also have no api to retrive the candidate group, how to retrive?

Hi @thinkdoom,

what about this query:

repositoryService.createProcessDefinitionQuery().processDefinitionKey("myBpmnProcessId").startableByUser("myUserId").latestVersion().singleResult()

Hope this helps, Ingo

thanks, I’v find it’s imporsoble to query by group.