Triggering an error event /cancel event using REST API?

How can error event / cancel event be triggered from REST API?

1 Like

Do you have a use case?

(first thought is using /message endpoint. But provide more context and can help you out)

Trying to model process by having a language agnostic aproach i.e using the Rest API and external task route.

The idea is to model the process in a semantically correct way and like any process there are business exceptions happeing. So what is the right way to model error/cancel event so it can be driven by a API based approach(read NO Java code)

Can you provide a more specific use case? An abstract definition is unclear when you are dealing with error and cancel events because they are usually attached to another task.

You are likely looking at using a Event Sub-Process with a message start event that would subsequently trigger you event.

Hi,

I’m also interested in triggering a boundary error event (on a User Task) through the REST API.
Is that possible?
Or how can another application trigger that event? What kind of info is needed? The task_id and the name of the error event?

Thx

1 Like

An Error Event is thrown within a activity execution. What you are describing is more of a Message Event.

If you are work being done by another application and want to report back a error event, then looking at the external task pattern is likely the route you want,

Hi @StephenOTT,

Sure, I can find another pattern to trigger the termination of a task but for me putting a message event to indicate an error loses the visualization aspect. I want my bpmn model to have this “error” lighting event and not an “envelop” message event.

1 Like

Except that you are trying to use a BPMN error in its un-intended usage. A Error is during the execution of the activity/task. Not typically a error from a outside event/system.

@kontrag you have asked this question ebfore and it was the same sort of discussions. The Error Event does not get support on a user task: BPMN Error event on User Task - How to correlate to the current instance, Raise BPMN error from a user task as a boundary event

You are receiving a Message from another system, which indicates the error.

If you were using a Intermediate Catch Event, you would not be trying to use a BPMN error for this. You would use a Message Catch event or a Receive Task

1 Like

Actually it’s a custom Tasklist application, if that’s considered an external system.
But I see that Error events are not supported on User Tasks.

Thx

The easiest workaround is to use gateway after the user task or use conditions sequences such as:

diagram_1

This is basically just your flow of “continue forward unless there is is a error”, where a “error” is a specific condition that is evaluated on Task completion.

Thx @StephenOTT

I have already implemented an XOR Gateway after the task to check its “status” (successful completion or failed completion).
What I don’t like though in that construct is that the task is saved as “completed” in the history DB, but I think that is inevitable (since User Tasks can get either “completed” or “deleted” status, right?)