Throw a BPMN error from a script task

Hello all,

I have a script task in a process that I need to implement it with javascript. Following this link, I wrote my inline script.

As shown in the image below, inside my script I fetch the process variable “oldCustomer” (Boolean), and if it is false I throw an error that is caught by a boundary error event.

var old=execution.getVariable("oldCustomer");
if(old==false){
  throw new org.camunda.bpm.engine.delegate.BpmnError(“NewCustomer”);
}

However, once I try to start the process from the Tasklis (I set as variable “oldCustomer - Boolean - false”), I receive the following message:

What am I missing here?

Thank you in advance.

Try selecting “Async Before” or “Async After” for the Script task.

Thank you so much for your answer, but unfortunately,it didn’t solve the issue

@smith_Johnson Put asyncBefore=true for the interrupting error boundary event

It looks like your real problem is the quotes around NewCustomer

throw new org.camunda.bpm.engine.delegate.BpmnError(“NewCustomer”);

This can sometimes happen when pasting text copied out of a rich text area/application. If you retype them as double or single quotes, you won’t have a javascript parsing error anymore

throw new org.camunda.bpm.engine.delegate.BpmnError("NewCustomer");

2 Likes