How to handle more than one business error with one external Service task

BPMN sample.bpmn (14.0 KB)

I have the attached BPMN in our solution. There are two error boundary events one from Get Images service task and another from Create Jobs service task. Now using the ‘Aggregate jobOutput on exception’ service task I have to take a different action based on the type of error.

Can you please help how can we identify what type of error was thrown in the handler(Aggregate jobOutput on exception).

Hi @Prem_Kumar,

you can use the errorCodeVariable and/or errorMessageVariable and push the content from the error (code or message) into seperate variables. These can be used in the final task.

Have a look at the docs for further details:

Hope this helps, Ingo

How can we access the errorCodeVariable from external service task.

Will it be added as an external task variable?

Hi @Prem_Kumar,

the value of errorCodeVariable is a variable name which will carry the code.

If you define errorCodeVariable as imagesError in the first task and as jobsError in the second task, you can access either imagesError or jobsError as process variable in the next task.

The variable content will be 100 in your example in both cases.

Another option would be to use different error codes and map the to the same process variable. Then you differentiate on the value afterwards.

Hope this helps, Ingo

1 Like

Thank you @Ingo_Richtsmeier,

That is really helpful. Thank you again for spending time on this :slightly_smiling_face:.

If I put errorCodeVariable in the input in the next task, I get the error failed to evaluate expression ‘{errorCodeVariable:errorCodeVariable}’: no variable found for name ‘errorCodeVariable’.