DelegateExecution does not have method like getStartTime() so Im trying to get start time of subprocess from HistoryService in notify() method. Im doing this at process start with parse listener but it gives error like down below.
Cannot invoke “org.camunda.bpm.engine.history.HistoricProcessInstance.getStartTime()” because the return value of “org.camunda.bpm.engine.history.HistoricProcessInstanceQuery.singleResult()” is null
delegateExecution.getProcessInstanceId() is not returning null and here is my code:
@Override
public void notify(DelegateExecution delegateExecution) throws Exception {
if (delegateExecution.getSuperExecution() != null) {
Date startTime = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(delegateExecution.getProcessInstanceId())
.singleResult()
.getStartTime();
} else {
}
}
Is this the time when the job was created? Or the time when its execution really started (by the job executor)? Whatever it is: how can I retrieve the other value (time)?
My question was about a job that is “in the middle of a process”. For the first job of the process, the two values are the same. But a job that is in the middle is created first and then picked up by the job executor. I wanted to have both values.