cancel
Showing results for 
Search instead for 
Did you mean: 

Behavior of TaskService.deleteTask

limcheekin
Champ on-the-rise
Champ on-the-rise
Hi,

I would like to find out more about the behavior of TaskService.deleteTask. What happened if this method being invoked when the task have assignee or without assignee and what is it impacts to the process instance? Will the process instance be terminated?

Best regards,
Chee Kin
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
The task record will simply be deleted from the database.

The process will actually be stuck, since there is no way to continue anymore through that path.
So this method should only be used in admin applications, where people know what they are doing.

Deleting a task makes no sense for an end-user. Closing the task, while providing a reason (eg 'task invalid, John already did this for me') is cleaner and a more traceable approach.

limcheekin
Champ on-the-rise
Champ on-the-rise
The process will actually be stuck, since there is no way to continue anymore through that path.

Noted. Is that means the process instance is always active?

Regards,
Chee Kin

limcheekin
Champ on-the-rise
Champ on-the-rise
The process will actually be stuck, since there is no way to continue anymore through that path.
Noted. Is that means the process instance is always active in this case?

Closing the task, while providing a reason (eg 'task invalid, John already did this for me') is cleaner and a more traceable approach.
Is that means provide a way for user to terminate the process (Let's say the user initiates a process by mistake)?

Regards,
Chee Kin

jbarrez
Star Contributor
Star Contributor
Noted. Is that means the process instance is always active in this case?

Yes, the process will be active (it will live in the runtime database tables forever if not removed).

Is that means provide a way for user to terminate the process (Let's say the user initiates a process by mistake)?

No, that would be this method on the RuntimeService:


/** Delete an existing runtime process instance.
   * @param processInstanceId id of process instance to delete, cannot be null.
   * @param deleteReason reason for deleting, can be null.
   * @throws ActivitiException when no process instance is found with the given id.
   */
  void deleteProcessInstance(String processInstanceId, String deleteReason);

Deleting a process instance this way, will also delete all attached tasks.

limcheekin
Champ on-the-rise
Champ on-the-rise
Noted. Thanks for your advice.

Regards,
Chee Kin