AnsweredAssumed Answered

loss of info with created subtask

Question asked by aurelienpel on Dec 30, 2014
Hi,

I needed to create dynamic tasks, so I am using this code :



//create a task
LOGGER.info("Create a subtask");
TaskEntity myNewTask = (TaskEntity)
   ProcessEngines
   .getDefaultProcessEngine()
   .getTaskService()
   .newTask();
                  
myNewTask.setName(name);
myNewTask.setParentTaskId(task.getId());
myNewTask.setDescription(docu);
myNewTask.setTaskDefinitionKey(mySubtask.getIdentifier());
myNewTask.setProcessInstanceId(task.getProcessInstanceId());
myNewTask.setProcessDefinitionId(task.getProcessDefinitionId());
                  
//save it
ProcessEngines
.getDefaultProcessEngine()
.getTaskService()
.saveTask(myNewTask);


With Capture1.PNG you can see that the subtask is correctly created with the right parentTaskId.
I can see this in ACT_RU_TASK, so this is OK.

However, in ACT_HI_TASKINST I can see my subtask, but not the processInstanceId neither processDefinitionId (have a look at Capture2.PNG). As I want to list the historic of the instance, I can see the tasks, but not the subtask. Why do I lose some data ? Indeed I need it to see the complete historic.. Is it a bug or do I forget something ?

Thanks for your help !

Regards

Outcomes