Create incident and stop process flow


could someone help me with my question, please?
Is there a way how to create an incident similar to one that is thrown by the engine when the exception happens?
I mean when something wrong happens in the engine, there is an incident and the process is stopped on last wait state. But when I create an incident in the script, the process will continue to the next task and if it reaches the end my created incident is deleted upon the process completion (not by me)
So I need to create the incident and stop the process from moving forward, I was also trying to call the suspend method but this is not helping because right after I call the suspend method in the same script where is the incident created, the token moves forward like he doesn’t care :confused:

createIncidentTest.bpmn (4.0 KB)

Thanks for your help,



See the delegateexecution java API doc


Hi Stephen,
thank you for your reply, but how is this different from the way that I create the incident in my example? Also, this won’t stop the process either, the behaviour is identical…


My memory was that the incident will stop the process, but if it is not, then your best bet would be to just throw a customized Exception, which will be picked up by the engine and a incident will be created by that thrown error. You could also create your customized incident before your throw the incident as well if you wanted.


Thanks, that is what I am trying right now :slight_smile:, but I was hoping for some “native” function :frowning:


Throwing a error is a native solution. The engine is setup to capture the error.

Incidents are system errors.

If you are trying to handle business errors, then look at using BPMN Errors


I know about errors but I am not trying to handle business error. It is more like technical error but there is no BE system involved so I have to raise an exception in the process. I already solve it with this code:
throw new java.lang.Exception(“exception messaget”);