Why and when to perform this task
Task instances are only automatically deleted when they complete
if this is specified in the associated task template from which the instances
are derived. The following example shows how to delete all of the task instances
that are finished and are not automatically deleted.
Steps for this task
- List the task instances that are finished.
QueryResultSet result =
task.query("DISTINCT TASK.TKIID",
"TASK.STATE = TASK.STATE.STATE_FINISHED",
null, null, null);
This action returns a query result set that
lists task instances that are finished.
- Delete the task instances that are finished.
while (result.next() )
{
TKIID tkiid = (TKIID) result.getOID(1);
task.delete(tkiid);
}