With call activity, I am not able to retrieve the tasks from the called process definition since it does not start automatically. The task service query from the first process instance is not giving the tasks from the called process instance. Could you help me with this query and suggest if there is a better way to retrieve the tasks from the called process instances.
I used activity instances to get the list of activities in the process instance. As per the parent flow SubFlow_CallActivity_Invoker.bpmn, completed the first user task 1 and then tried to query the task service to get the next active task (which was supposed to be the user task 3 from the called definition), but didnt get any result from the called instance.
Am i missing any additional query or should i start the called instance separately and link it with parent instance somehow to get those usertasks ?
I was using task service to query for active tasks in the current process instance
The query I used is:
taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
This is supposed to give me the current active task. Since Call activity is not a task, I used the activity instances to get the list of activities.
List callActivity = processEngine.getRuntimeService().getActiveActivityIds(processInstance.getId());
ActivityInstance[] activityInstance = processEngine.getRuntimeService().getActivityInstance(processInstanceId).getActivityInstances(callActivity.get(0));
BpmnModelInstance bpmnModelInstance = repositoryService.getBpmnModelInstance(activityInstance[0].getProcessDefinitionId());
Activity userTask = (Activity) bpmnModelInstance.getModelElementById(activityInstance[0].getActivityId());
When the activity is of type call activity, I thought the “called instance” definition is started automatically and the user task from the called instance is called automatically. But this didnt happen i am expected to start it programatically.
I guess that processInstanceId is the superProcessInstanceId, correct me if I am wrong.
In this case it won’t work.
When you start the instance you can assign business key to the process and the query like this:
Yes, with business key I am able to get the sequence of the tasks from the called instance.
When i discard my child instance (which is called from a call activity invocation) manually, the call returns back to the parent instance and is currently at call-activity. Is it possible to complete the call activity forcefully and move to the next task in the parent instance.