How we are getting Start time and end time of a particular task in Camunda Cockpit as a separate fields…?
Hi @ranjith,
sorry, but I did not understand your question fully. Do you want to get start and end date of activity in your java delegate or display it in some specific place in cockpit?
Cheers,
Askar
Hi aakhmerov,
Yes aakhmerov, How Can I get the starttime and endtime of activity in my java Delegate ?
Thank you
Ranjith Gadudasu
Hi @ranjith,
should be something like
HistoricActivityInstanceQuery historicActivityInstanceQuery = execution.getProcessEngineServices().getHistoryService().createHistoricActivityInstanceQuery(); historicActivityInstanceQuery.activityId(execution.getCurrentActivityId()).singleResult().getStartTime();
please see https://docs.camunda.org/manual/7.6/user-guide/process-engine/delegation-code/ for more details on how to implement delegates.
Does that help you?
Askar
Thank You Askar It’s working.
But, My requirement is to log the “activityinstance Start Time which it is executing”
So I created ExecutionListener and Inside notify method I am trying to log.
As I am using HistoryService I am getting previous But Not current one.
Can you please let me know how to get current ActivityInstance StartTime, Duration in ExecutionListener Class.
Thank you
Ranjith Gadudasu
Hi @ranjith,
if you are in the start execution listener, why wouldn’t you just take current timestamp as startTime?
Cheers,
Askar
duration you can either calculate in end listener or later on based on history data.
Does that help you?
Askar