Commands and dialogsModel-driven app

Delete

A confirmation dialog for removing rows, where the table relationships decide what happens to related rows.

Show me in the demoOpens the demo app with this component highlighted.

What it is

The Delete command removes the selected row or rows. A confirmation dialog, Confirm Deletion, warns that the action cannot be undone and asks you to confirm. What happens to related rows depends on the cascade rule of each relationship. A restricted relationship blocks the delete with an error message that names the related row.

When to use it

Use it for rows that were created by mistake or are no longer needed. If the history matters, use Deactivate and activate instead and keep the row. In a subgrid the same command might only remove the link (see Subgrid).

Licensing and configuration

No extra licence. The user needs the Delete privilege on the table. The relationship behaviour is set per relationship in the table editor, under the Delete action: Cascade All, Remove Link or Restrict. Microsoft's standard types are Parental (deletes children too), Referential, Remove Link, and Referential, Restrict Delete, which prevents deleting a parent while children exist.

Pitfalls

  • A parental relationship deletes every child row with it. Check this before you build the data model, as there is no undo.
  • Restrict Delete stops the delete, so a user needs to remove or move the children first. Make the error message clear.
  • Remove Link clears the lookup on child rows, which can leave rows without a parent.
  • A row used as a Lookup target on other rows may not be deletable.

Try it in the demo

  1. Open the Accelerator form at the deep link and select Delete on the command bar to see the confirmation.
  2. Select Cancel. Then open Categories and try to delete a category that accelerators use. The delete is refused.
  3. In the demo, notes and tasks of a deleted row go with it.