Deletes a record.

deleteRecord uses this User Interface API resource.

  • recordId—(Required) The ID of the record to delete.

The return type is void.

deleteRecord accepts a single record ID. To delete multiple records, use Promise.all() or Apex.

This example displays a list of account records with a delete button next to each account name. When a record is deleted successfully, the component displays a toast message and uses refreshApex() to refresh the data provisioned via the Apex @wire.

When you successfully delete a record, any component that's subscribed to the deleted record via a wire returns a 404 error for that record data.

Don't call deleteRecord from a record page for a record that you want to delete. The record is deleted and you receive a 404 error with a message "The requested resource does not exist".

See Also