cancel
Showing results for 
Search instead for 
Did you mean: 

How to cascade delete process instance using REST API?

ssun
Champ on-the-rise
Champ on-the-rise
The question was asked here http://forums.activiti.org/content/how-cascade-delete-process-instance-rest-api
But no real answer.

For my case, what I have is:
A parent workflow has a call activity task.
The call activity task calls a child workflow.
After the child workflow is called, I can see 2 process instances. One for parent workflow, one for child workflow. I see only one task, which is the child workflow task. I cannot see the parent "call activity" task. That makes sense since that task is to call child workflow and it has successfully called it and finished.

Now, I need to delete the child process because I made a mistake. After I delete it, I see only one process instance for the parent process now. But it is like a ghost. It has no task and cannot be complete.

Is there a way to also delete the parent process instance when I delete the child?

Thank you very much!

–Gordon

4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I would say there are 2 possibilities:
1. Combine several rest requests to get list of parent <-> child process instances and delete all of them afterwards (there will be several transactions)
2. Implement your own rest service to cascade delete processes. (you can create pull request afterwards.

Regards
Martin

ssun
Champ on-the-rise
Champ on-the-rise
Thank you Martin
Is there anything I can do at the BPMN level such us terminate the parent process whenever the child process ends/deleted.
And how activiti end the parent process end when child process end? How was that implemented? Event/Message listener?

–Gordon

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Gordon,

whenever the child process ends.

And how activiti end the parent process end when child process end?
When Child process ends - parent process can continue in the execution. (when there is end event - parent process ends too).
In the case of child process delete, child is deleted, parent is kept in the waiting state.

Regards
Martin

ssun
Champ on-the-rise
Champ on-the-rise
Thank you Martin. And what I found out for the REST API is that if I delete the root parent process, all child process, grandchild process are all  deleted.