How to check for bounded BPMN-Error events on User Tasks?

I want to create a general user task handling in my app. So if I want to escalate the user task via an attached boundary event, I have to “know” that, but is it possible to ask the user task for an attached event or BPMN-error?
I’ve tried looking for event subscriptions when a process instance reached a user task with such a BPMN error event, but it doesn’t get listed in the result.

Thanks!

Hey @SafeAndSound ,
since the Camunda 7.12 release it is possible to attach an error boundary event to the user task. You can read more about it here: User Task | docs.camunda.org

The query on the other hand just works for messages, signals, conditional and compensate events. Therefore the error is not in the returned list.

If you want to use the query, you could change the error event to an attached boundary message event.

I am not 100% sure if one can query directly for a bpmn error event on the user task. You could include a variable on the user tasks that include the error code and query for the variable…

I hope that helps. Cheers Nele

Hi @Nele,
thank you for the quick reply!

I really would like to keep the event as a BPMN-error event, because referring to what is actually happening should really result in an error on that user task. Also, I want to work with the assignment attributes when I generally querying for it, making the BPMN-Error event more like a controlled optional cancelation by the user of a current user task, which would get lost if I would query for event subscriptions and filter my way through the right event which is pointing to a certain user task and its assignee, I guess.

You already mentioned that the event subscription does not include the bpmn-error events and I don’t know if I want to ‘flag’ all the user tasks by an extra variable for that kind of “optional cancelation”, because I feel like the information about the possibility is already “there” or “modeled”.

With having no form included the concept would be simple, complete on success, or cancels by BPMN-error.

So, any further ideas?

Cheers,
Tim

Ahh hello Tim (@SafeAndSound ) :wave: ,

I think you ask for something that does not exist yet :wink: So just let me see if I got it right: You would like to query the task and somehow get the information if the task has an attached error boundary event?
If that is the case this might be worse a Feature request.

I can just give you the following workaround solutions for now:

  • My first idea was to create a local Variable for the Usertask with a Tasklistener and then if you query the task you could query the variable.
  • Second thought you could use property extensions to include the bpmn error at a Usertask
  • Third idea: You could query for the whole bpmn diagram and then parse the diagram to find out which usertask has an attached error boundary event (but as far as I understand your case this might be a little bit of an overload to do that for every instance of a Usertask…)

Sorry I can’t give you what you want… I think you have to create this extra property or variable for now.
I hope that helps, Cheers Nele

1 Like

Thanks, @Nele!

I would like to go for the property extension solution, but I’ve never used them before. Could you explain this approach in a little bit more detail and how to access or filter for it using REST?

Cheers,
Tim

Hey @SafeAndSound ,

If you just want to use the REST API property extensions are not that simple indeed. There are quiet simple with Java. You could do it though but you would need to extend the REST API to return the extensions of the User tasks.

You can get the same feature with the local variable option without the need to change the REST Api. You could create a local variable with a task listener. If you then query the task you will get the variable and once the task is complete it will disappear.

Did you already created a FR? This might be really good for the future as I think it makes a lot of sense to query for attached error boundary events on tasks.

Cheers,
Nele

Yes, @Nele,

I’ve opened Query for BPMN-Error Event(s) on User Tasks.
I think I will just go for the local task variable approach then.

Thanks for your support!

Cheers,
Tim

1 Like