Delete Selected Records
Overview
The Delete Selected Records interaction allows users to remove one or multiple records from Salesforce directly from the Data Table. To prevent accidental data loss, this interaction includes a built-in confirmation workflow that requires the user to verify the action before the deletion is processed.
Prerequisites
The Delete Selected Records operation is exclusive to the Data Table component.
User Permissions: The running user must have the "Delete" permission in Salesforce for the object being managed.
Component Type: This interaction is designed specifically for the Data Table's row-selection architecture.
How to Configure Delete Selected Records
1. Enable Selection
For the component to identify which records should be removed, row selection must be active.
In the Data Table property editor, ensure "Hide Checkboxes" is unchecked. This enables the selection column required for bulk deletion.
2. Choose Your Interaction Placement
The behavior of the Delete Selected Records operation is determined by its placement:
Header Action
Mass Delete: Deletes all records currently checked/selected by the user.
Checkboxes must be enabled.
Row Action
Single Delete: Deletes only the specific record where the action was clicked.
Does not require checkboxes.
3. Create and Configure the Interaction
Once you have created your Header or Row actions in the Properties panel, set up the interaction logic:
Navigate to Interactions: Open the Interactions tab in the component builder.
Select Your Action:
For Bulk Deletion: Click on the Add Header Action Click (using the header action you created).
For Single Record Deletion: Click on the Add Row Action Click (using the row action you created).
Assign the Operation:
Type: In the operation dropdown, search for and select Delete Selected Records.
Target: Ensure the target matches the specific Header or Row action name.

4. Post-Action Configuration (Optional)
To ensure the UI remains accurate after records are removed:
On Success: It is highly recommended to add a Refresh All Queries interaction so the deleted rows disappear from the table immediately. Adding a Show Toast notification (Success variant) is also recommended to confirm the action.
On Error: Add a Show Toast notification with the "Error" variant to display Salesforce system errors (e.g., the record is associated with a restricted relationship).
User Experience & Safety
To ensure data security, the user workflow includes a mandatory confirmation step:
Select: The user checks the boxes for the records they wish to delete.
Trigger: The user clicks the Delete button.
Confirmation Modal: A warning modal automatically appears asking the user to confirm the deletion. The action will not proceed until the user clicks "Confirm" in this modal.
Execution: Upon confirmation, the component processes the deletion and refreshes the view.
Technical Details & Limits
Safety First: The confirmation modal is a native feature of the interaction when used on a live page; you do not need to build a separate "Are you sure?" flow.
Automatic ID Collection: The component automatically gathers the IDs of all selected rows and handles the batch deletion call to Salesforce.
Transaction Safety: The operation is optimized to handle bulk deletions in a single transaction, respecting Salesforce governor limits.
Restricted Deletions: If a record cannot be deleted (due to Apex triggers, Validation Rules, or master-detail relationship constraints), the entire transaction will fail, and the error can be caught via the "On Error" interaction.
Last updated
Was this helpful?
