Multiple Delete actions

Introduction

When working in a WorkWith interface, the user may need to delete several records. Unlike the Insert or Update operations, the Delete operation may be executed on many records at once. The user just has to select the records that should be deleted and execute the “Delete” action.

When using K2BTools, the “delete” action is always available to delete a single item. However, this behaviour can be easily updated to support multiple deletes as well.

Using the Multiple Delete action

Multiple Delete actions can only be generated for transactions whose “Business Component” property is set to “True”. This is necessary because the code genearate relies on the BC to perform validations before deleting the items selected by the user.

Activating multiple deletes

The Multiple Delete action can be activated at a KB level or at an instance level.

To activate it for the entire KB, use the “Enable Multiple Delete” property in the “Delete” node present in K2BEntityServices Settings. Note that when doing this, the multiple delete action will only be activated for transactions that are a business component.

To activate the action for a pattern instance, use the “Multiple Delete” property in the Standard Actions node. If the transaction is not a BC, an error will be shown.

Multiple Delete configuration

Once enabled, the multiple delete action can be customized in K2BEntityServices Settings.

Confirmation

The multiple delete action may require user confirmation when deleting more than one item. To configure this dialog, use the “Multiple Delete Require Confirmation” and the “Multiple Delete Confirmation Message”.

MultipleDeleteRuntime
Multiple Delete Runtime Appearance

By default, the action required confirmation using a standard message translated to English, Portuguese, and Spanish.

Error Handling

Before deleting an item transaction rules are validated and referential integrity is checked. When deleting several items, these validations may fail for a subset of the selected items. The developer can choose how to handle those cases using the “Multiple Delete Error Handling” property:

  • RollbackAll: If any delete fails, rollback all changes and show the errors.
  • CommitCorrectChanges: Commit all successful delete operations, show the errors for the items that could not be deleted.

The success and error messages can be customized using the “Multiple Delete Error Message”, “Multiple Delete Success Message”, and “Multiple Delete Rollback Message”