Can we delete process variable from a TaskListener?

Hi all,

I have set a input parameter in BPMN and I use this in the TaskListener to perform few tasks.

Now once the task is done I want to delete these variable (I don’t want them in future steps). I was looking at deleting these variables. I read through Process Instance Modification | but couldn’t find a way for deletion.

However, the same is available as Rest API.

Is this possible in runtime? Or is there is some other way?


Harsha P

1 Like

If you’re implementing the TaskListener with a Java class you just need to ask the execution to remove the variable.

 public void execute(DelegateExecution execution) throws Exception {

can we cancel whole process ???

@ANKIT_SHARMA, you can suspend(pause temporarily, can be resumed later)/delete(removes from runtime) process instance from runtime. You can handle cancelling the process by modelling terminate end event or interrupting timer start event in event subprocess which will further terminate the running instances, etc.

To suspend the running process instance:


Delete an existing runtime process instance:

execution.getProcessEngineServices().getRuntimeService().deleteProcessInstance("processInstanceId", "deleteReason", true);