Unable to start Call-activity's called process definition automatically and retrieve tasks


#1

Hi,

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.

SubFlow_CA_Called.bpmn (4.0 KB)
SubFlow_CallActivity_Invoker.bpmn (4.1 KB)

Thanks and Regards,
Divya


#2

Hi Divya,

What do you mean by “it does not start automatically”?
What steps have you performed?

Best regards,
Yana


#3

Hi,

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

Thanks and Regards,
Divya


#4

Hi Divya,

Could you please share how your query looks like

Best regards,
Yana


#5

Hi,

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.

Regards,
Divya


#6

Hi Divya,

I see.

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:

taskService.createTaskQuery()..processInstanceBusinessKey("businessKey").list();

Could you please try this approach.

Best regards,
Yana