How to get the process cron schedule with java api
2 answers
Hi Enrico,
You are perfectly right, the API method searchTimerEventTriggerInstances() takes a processInstanceId as a parameter, so it means that it only applies to timers linked to a process instance, that is to say, intermediate timers, boundary timers, and event-subprocess start timers.
For normal start timers, they are not linked to a specific instance, as they are defined on a process definition to trigger the creation of instances.
To retrieve them, you need to retrieve the process definition and inspect the start timers and their start condition:
ProcessManagementAPI.getDesignProcessDefinition().getFlowElementContainer().getStartEvents() ...
Hope this helps (better this time ;-)
Comments
Thank you. I want to know the duration of a start event. I did the following test:
Start a simple process with a timer (duration 1 minute) and human task; Retrieve the processInstanceId from the portal; Execute programmatically the query you suggested;
I don't get any results for my start timer. I guess it's logic I think the start event is archived at the moment.
Is there any way to workaround that? I don't see any searchARCHIVEDTimerEventTriggerInstances() in the api... Thanks
Have you tried search for EventInstance "name"?
Yes, with searchOptions.filter(TimerEventTriggerInstanceSearchDescriptor.EVENT_INSTANCE_NAME, "Start Timer");
Start timer events are not detected.
If I update the process adding a timer event "Timer2" after the human task, and I run the search before this timer is activated, then I find it correctly.