I have a few questions to do with tasks…
Using code (not REST API) what is the best way, with having a process id to get the currently active task (no parallel tasks yet) in the the active process?
I noticed the TaskService API had many methods that took taskId as a parameter but i’m not sure how to get a taskId for a task in an active process.
Is an instance of a Task called an Activity? If not, what is an Activity?
runtimeService execution query. execution.activityId
taskService.createTaskQuery().processInstanceId('').list() for list of tasks for given process. (If you are searching by included user it is also possible)
No, activity can be userTask, or any other activity in the process.
thanks for the prompt response!
i am confused then, i can see where taskService.createTaskQuery().processInstanceId(processId).list() would return a list of tasks because taskService is task centric.
but, in my code, runtimeService.createExecutionQuery().processInstanceId(processId).count() == 2 which surprises me.
seems like if i kick off a new instance of a workflow and get a single processId from doing that then that processId would return only one execution since a process instance is the same as an execution…
processInstance is execution too. use
hopefully i can better explain what i need so not to take up more of your time on this subject… the scenario is we are creating a prototype to convince our boss to go with Flowable and we have one part where an independent microservice must check where in our workflow (i.e. which activity) is currently waiting for an outside reply. the microservice has access to process ids.
so i was hoping there was a simple…
Activity currActivity = someFlowableServiceObj.getProcessIntanceById(someProcId).getCurrentOpenActivity()
that’s what i was trying to find out in my first question.
// in your case only one execution is selected
List<Execution> executions = runtimeService.createExecutionQuery().onlyChildExecutions().processInstanceId(processInstance.getId()).list();
// activityId is id from the modeler. Can be any wait state (user task, async service task, receive task.....)
List<String> activityIds = executions.stream().map(Execution::getActivityId).collect(Collectors.toList());
thanks for the info!