Two tasks if one is completed second task is not needed any more

I define the registry process as follows: 1- User submit request. 2- Admin check request. If request needs editing, two tasks will raise, “Edit Request by User” and “Approve/Reject by Admin” (second task is used because user may not continue so that admin could finish the process).

If one of the tasks is completed, the other task should be canceled and only one path of execution continued. How can I do that? Now if User complete “Edit Request by User” task, the “Approve/Reject by Admin” remains active (two paths of executions)

You could attach a task listener to the tasks and programmatically complete the other task. For instance when Task A completes you can attach a listener to the complete event of Task A and then complete Tsk B. And vice versa.

1 Like

Hi @Simin,

You can attach an interrupting boundary conditional event to both tasks and define the condition based on a flag variable to be updated once any of the tasks get completed.

image

2 Likes

Thank you @haiko . I already complete the other task programmatically but I wonder there is any solution to solve it using BPM model

Hi @hassang
Thanks for your suggestion, if the flag of boundary condition becomes true, it would not wait until the task to completed?

Hi @Simin,

What I meant is to set the flag to true once any of the tasks get completed so the boundary event of the other task gets triggered which in turn ends the pending task.

Output parameter approach can be used to set flag variable to true (assuming flag variable is available on process level)

or TaskListener approach (attached to task completion event) can be used to set the flag variable to true.

1 Like

Thank you, I will test it

Hi @Simin,

Kindly find attached a working example
test-process.bpmn (9.5 KB)

Edit: the working example can work without the “Initialize flag to false” task but “Variable Events” of conditional boundary events should be changed to involve “create” event as in below snip

1 Like

Thanks @KevinBPMN , it is complected, would you please explain a bit, thanks

Perfect @hassang, thanks.

1 Like