AEM : Advancing workflow after exception in a custom process step
Requirement : There’s an exception while a step is executing and instead of terminating the workflow, we want to advance the workflow to next step.
Ideally, a workflow can not be advanced if there’s an exception in the executing step. Either the workflow has to be retried or terminated. Here, we will see how programmatically a workflow can be advanced in this situation.
For this I’ve created workflow with two steps.
Here the first step that reads “step that throws exception” is the step that is custom process step. In this step we will use try catch to catch WorkflowException. In catch block we will complete the item and advance to the next step using routes. Below is the code snippet.
Below is the sample logs that shows from which step to which step the workflow has advanced.
Reference :
Also Read :