How to terminate user tasks with boundary events?

Hi,

I am creating a new approval process and it looks like this:

It’s a process, which calls a embedded subprocess. This subprocess contains three call activites, which calls the same subprocess, only the input variable for the category is different.

The subprocess looks like this:

In “Get Category”, a Java Delegate is called to get the evaluate the category (passed as input variable) if it needs to be approved or not. If not, the task ended successully. If the category needs to be approved, a user task is created. Depending on the decision, the subprocess ended normaly (approved) or the task shoud emit an event (in case of not approved).

The final result should be, that if one of the three subtasks (from the call activities) emits an event, all other user tasks will be canceled and the “final token” runs to the “Modify Data” user task.

I tried different way (end tasks with message, intermediate / boundary event), but it didn’t worked.

I also tried three different subproceses (three times the same content - only the process names were different and the message name that was emitted), but no success.

I hope someone can help me, how to design such a workflow.

Thank you very much in advanced,

Rainer

1 Like

Hi @Ironarrow,

Can you please share your implementation for send messages and if possible your models.

Hi @Ironarrow

Some insights:

You don’t have to attach boundary messages to call activities, attaching them to surrounded subprocess should be enough.

You can use only one boundary message to catch any unapproved data since the same logic to be applied.

Hello Hassen,

thank you for your answers. The three boundary messages was one last try yesterday evening.

This morning, I reduced the workflow to one subprocess.

And the subprocess looks like:

My output is the following:

subprocess: Ended with Error (<-- this is correct - it’s the output of the bottom right service task in the subprocess)

success (<-- this is wrong. This is not the “boundary” path of the main process)

Any ideas?

Hi @Ironarrow,

Implementation should be identified for send message.

Below post contains a simplified example in which expression is used to send message

Hi @Ironarrow ,

Kindly find attached a simplified working example (Note: supply a value for the business key when you start the main process)

terminate-process.bpmn (8.8 KB)
terminate-called-process.bpmn (4.7 KB)

Hi Hassan,

thank you very much for your sample. Now I found my “problem”. In the message end event I entered the same value for Global Message referenced like in my main process. I thought this will be enough for sending the event. The process got the information that this is a message end event, it has got the name of the event - but no message was send.

But in your example I saw, that I have to implement a function call to send the event. After I added this code, the message was sent and received and everything works fine.

Thank you very much!

Regards,

Rainer

1 Like