Cancelling the order in intermediate stage

Current workflow step is in “Approve Order”.

And the user wanted to cancel the order, if user cancels the order it should skip the “Dispatch Order step” and move the execution to end of the workflow.

So which of the below strategies should be appropriate?

  1. Compensation boundary event(interrupting)
  2. Cancel boundary Event(interrupting)
  3. Message boundary event(interrupting)
  4. Conditional boundary event(interrupting)
  5. Deleting the running instance by process instance id

How can we model this in bpmn?

Note: Order Cancellation is via Rest API

BPMN wise, an error boundary event would be the most appropriate, if it’s the user that makes that decision when performing the task. However, at the moment you’re not able to define and trigger such boundary events (like errors and escalations). I recently discussed with the team to add this for some situations.

In your case, however, I wonder whether a gateway after the user task is not the best option. Your task is called “approve order”. Approval normally supports at least two valid outcomes: approval and rejection. So if rejection of the order is what you’re looking for, I would let the user make a decision in the task, complete it normally and after the task place an exclusive gateway that decides to either continue or end the process, based on the user’s decision.

1 Like

you mean if the user makes decision, then none of the attached boundary events are triggered for that usertask.

If rejection is what you’re after, indeed. The task just completes normally. The decision the user took is stored in a process variable, which is used in the gateway to decide what to do next.

Errors and escalation boundary events are for when the task cannot be completed in a normal way. With rejection, it can.

1 Like

Understood. Suppose i have attached a Conditional boundary event(interrupting) to the usertask, when user performs that task and updates the processVariable, then the boundary event will trigger or it will skip boundary and gives preference to user decision whether its approve or rejection.