Disable manual start of processes if condition is not met

Hi everyone,

I’m not sure if this was already asked but is there a possibility to disable the manual start of a process if a condition is not met?

For example, I’m currently working on a project with multiple process phases and in phase two you shouldn’t be allowed to start a process instance of phase one.
Of course, I could check immediately after a process has been started whether the execution is allowed and direct to an end event if it is forbidden. But it would be nice if I could just disable the possibility to start the task in the first place.

If it’s not possible (which I’m guessing), I might have to hide the process externally.

Thanks in advance!
Leo :slight_smile:

See Limit number of concurrently running instances of a process definition

You can use the API to check for running instances and then throw a exception if you find one.

Thanks for the response!

As mentioned in your quoted post that suggestion is indeed pretty “hackish” but would be a valid solution for my situation.
I think hiding the processDefinitionKeys is still a cleaner solution for my use case (I’m already using a custom Tasklist).
I will mark your your answer anyway since it would also fix the issue. :slight_smile:

At the time it was thought of as hackish: but the more you dig into how Camunda implements most of its internal functionality, using a listener I would strongly argue is the most preferred way. (As a example, history events for the history tables are implemented through listeners that are injected during deployment).

But isn’t it confusing from a usability point of view that you could start a process which does not make sense in the current context? And then even worse, if they try to run it nothing happens (or an exeption gets thrown).


it sounds like you have a business contruct whose lifecycle exceeds the duration of a process, but you want the lifecycle of the business object to inform process validity.

Another approach you could consider is use of CMMN. With CMMN you can restrict processes to stages etc, however, whilst elegant, investment in CMMN is a steep learning curve…


When you throw an error you can set the message. So your message would be like “unable to start phase 1 as another process is currently in phase 2”

Thank you.
It’s too late for this project. But I will add it as an possibility for a follow-up project in the outlook part of my documentation. :slight_smile:

Ok. I think use both the listener and the process hiding. So the process isn’t shown in my custom tasklist, but if it is mistakenly started anyway (for examply via the camunda tasklist), nothing breaks either.