AnsweredAssumed Answered

Difference between delete process with single task and delete that task

Question asked by anindya on Apr 1, 2016
Latest reply on Jan 25, 2017 by pero
I have a process with a single task.
For some reason I want to delete the task/process.
What will be the preferred way?

If I delete the process with :                                       
                               runtimeService.deleteProcessInstance(processInstanceId, deleteReson) ;
the deletion is successful.

But when I try the following code :                           
I got the following error :
                              org.activiti.engine.ActivitiException: The task cannot be deleted because is part of a running process.

So, what is the difference between these two?
and also, when can I use taskService.deleteTask(taskId) ?