Deleting process instances using REST asnyc API

I have a process that spawns 2 child processes instantiated using the call activity. when I delete the top level parent process, I want all the child processes to be terminated/deleted.

I am using the async API (process-instance/delete) to delete the instances asynchronously. It deletes the instances, but I see a long log on the server that the instance id is not found.

Is it that when the parent instance is deleted all the child process instances are also deleted and because of which I am seeing this error?

Can I just delete the top level parent to delete all the instances? or is it better that I send a signal to each of the process instance to terminate them? what is the better approach?

I use the business key to identify all the child instances and pull all the instances that have that business key and issue the delete (async) command.

Hi Adat,

Is it that when the parent instance is deleted all the child process instances are also deleted and because of which I am seeing this error?

Yes, this is the reason why you see this stacktrace.

Can I just delete the top level parent to delete all the instances?

This should be enough.

If you want to skip the subprocesses in the deleting, you can use this method

void deleteProcessInstances(List<String> processInstanceIds,
                          String deleteReason,
                          boolean skipCustomListeners,
                          boolean externallyTerminated,
                          boolean skipSubprocesses)

Per default the sub processes are not skipped.

Greets
Chris

@Zelldon Thank you. I removed the unnecessary loop and can terminate all the instances just by terminating the Parent process now

1 Like