Cancel a process instance using Bonita Engine API

Hi,

I want cancel a process instance when I press a button of a Form, I use the Engine API

import org.bonitasoft.engine.api.APIAccessor;
import org.bonitasoft.engine.api.ProcessAPI;

ProcessAPI processAPI = apiAccessor.getProcessAPI();
processAPI.cancelProcessInstance(processInstanceId);

I get an Null pointer Exception

I think you’re missing the bit that says

getprocessInstanceId…

You’ve got the api now you need to cancel the actual instance of the process :slight_smile:

Good hunting, off to catch a plane…can’t do any more today.

regards

Thank you for you response, I can get the processInstanceId using the super variable processInstanceId of Bonita, I want to cancel the current instance of the process.

Which version of Bonita BPM are you using?

Do you want the user to be able to cancel the process instance at a specific point in process execution or at anytime?