Validations before starting process instance

Hi all,
I want to execute a script or some piece of validation code in these scenarios.If the validation fails i want to roll back /throw an exception.
1)Before starting a process instance . If validations fail process instance should not get started.
2) Before creating of the task/Before the marker enters a task. Rollback to the previous step if validation fails.

can the camunda listeners of be any use to me in this case??

TIA

You can do that with execution listeners - they can be classes or scripts that can you can code to run validation. If it throws an exception it will roll back to the last known state, that can mean that maybe a user task will not move forward or a process will not be started depending on how you use it.

1 Like