Deleting a Case Object by Composite Case Identifier

Within a process, you can delete a single case object whose composite case identifier matches the values that you supply.

Prerequisites

The process must already contain data fields containing the composite case identifier values of the case object that you want to delete.

Each data field must be of the same type as the appropriate composite 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 the 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 the case object has any active links to other case objects, the delete operation will fail.

Note: The best practice is to not delete case objects as part of a normal operation. If you do delete case objects, the best practice is to only delete using a single case reference from within a service task in a process. For more information, see Reasons to Avoid Deleting Case Objects.

Procedure

  1. Add a service task at an appropriate point in the process.
  2. On the General tab of the Properties view, set Service Type to Global Data Operations.
  3. Select Create Case Object(s) or Delete Case Object(s) by Case Identifier.
  4. In the Case Class field, select the appropriate case class for the case object that you want to delete.
  5. In the Operation field, select Delete Case Object by Composite Case Identifier.
    A Where CIDAttributeName equals value of field is displayed for each attribute of the case class that forms its composite case identifier.
  6. In each Where CIDAttributeName equals value of field, enter the name of the local data field that contains the value of the case object to be deleted for this CIDAttributeName

What to do next

  1. (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.
    Error (Error Code) Description Possible solutions
    UserApplicationError (CaseNotFoundError) The case object specified in the Where CIDAttributeName equals value of fields does not exist.
    UserApplicationError (DeleteWhileLinkedError) The case object specified in the Where CIDAttributeName equals value of fields has one or more association links to other case objects.
    1. Delete the association links.
    2. Retry the Delete Case Object by Composite Case Identifier operation.
  2. (Optional) Modify any process that may need to do something if this case object is deleted:
    1. Add a case data signal event to the process, so that the process will be notified if the case object is deleted.
    2. Add suitable business logic to perform any actions that the process needs to take as a result of the case object being deleted.