Deleting Case Objects by Case Identifier
Within a process, you can delete one one or more case objects whose case identifiers match the values that you supply.
Prerequisites
The process must already contain a data field containing either:
- the case identifier value of the case object that you want to delete.
- an array of case identifier values for a set of case objects that you want to delete.
The data field must be of the same type as the case identifier attribute in the case class.
Each case identifier value(s) must be a complete and exact match for the case object that is to be deleted. You cannot use partial matches or wildcard characters - these will result in a CaseNotFoundError runtime error.
If a case object that you want to delete has any association links to other case objects, you must delete those association links before attempting to delete that case object. If any case object has any active links to other case objects, the entire delete operation will fail - no case objects will be deleted.
Procedure
- Add a service task at an appropriate point in the process.
- On the General tab of the Properties view, set Service Type to Global Data Operations.
- Select Create Case Object(s) or Delete Case Object(s) by Case Identifier.
- In the Case Class field, select the appropriate case class for the case object(s) that you want to delete.
- In the Operation field, select Delete Case Object(s) by Case Identifier.
- In the Where case identifier field, enter the name of the case identifier that you want to use to identify the case object(s).
- In the Equals value of field, enter the name of the local data field that contains the case identifier value(s) of the case object(s) to be deleted.
What to do next
- (Optional) Add appropriate error handling to the service task boundary to deal with the following specific errors that may be returned by the
Delete Case Object(s) by Case Identifier operation.
- (Optional) Modify any process that may need to do something if this case object is deleted:
- Add a case data signal event to the process, so that the process will be notified if the case object is deleted.
- Add suitable business logic to perform any actions that the process needs to take as a result of the case object being deleted.