When I start a process from the Tasklist, when is the current “ProcessInstanceId” created (I mean saved in the database)?
I’m asking that because I want to have a check in the “Start” button that if that process is already running, then a new instance shouldn’t be started.
If I put a listener at the Start event, how do I check it?
Process instance id is globally unique across multiple process definitions. So it will always creates new instance id when starting a process instance. So it’s better to search by businesskey or with process/task variables whether the instance already exists or not. Before starting a process, you can query for process instances using REST API or Java API.
If you configure task listener for querying process instance, you can throw exception if instance already exists or u can create new instance through JAVA API.
You can get processEngine instance from DelegateTask. You can configure ExecutionListener also
right after I push the “start” button in the tasklist, this will bring me the process_instance of the current one (at least), right? So, if more are already running, how to distinguish them? Maybe just check the count?
If count>1, then abort…
this will return you all the running(processState=Active) instances of the process definition “My_Process”. You can get total count of the active instances.
You can iterate through the list of process instances and check whether the process instance already exists.