This topic applies only to the IBM Business Automation Workflow Advanced
configuration.

Deleting process instances

Draft comment:
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15
Completed process instances are automatically deleted from the Business Process Choreographer database if the corresponding property is set for the process template in the process model. You might want to keep process instances in your database, for example, to query data from process instances that are not written to the audit log. However, stored process instance data does not only impact disk space and performance but also prevents process instances that use the same correlation set values from being created. Therefore, you should regularly delete process instance data from the database.

About this task

To delete a process instance, you need process administrator rights and the process instance must be a top-level process instance.

The following example shows how to delete all of the finished process instances.

Procedure

  1. List the process instances that are finished.
    FilterOptions fo = new FilterOptions();
    fo.setSelectedAttributes("PIID");
    fo.setQueryCondition("STATE=STATE_FINISHED");
    EntityResultSet result = process.queryEntities("PROCESS_INSTANCE", fo, null, null);

    This action returns a query result set that lists process instances that are finished.

  2. Delete the process instances that are finished.
    for (int i = 0; i < result.getEntities().size(); i++) {
      PIID piid = (PIID) result.getEntities().get(i);
      process.delete(piid);
    }
    This action deletes the selected process instance and its inline tasks from the database.