The query I used is:
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.getProcessDefinitionId());
Activity userTask = (Activity) bpmnModelInstance.getModelElementById(activityInstance.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.