Delete Record
Overview
The Delete Record interaction allows you to permanently remove a Salesforce record directly from your Dynamic Component. This interaction requires a Record ID to identify exactly which record to delete.
This action is irreversible within the component (though the record may go to the Salesforce Recycle Bin depending on your org's settings).
Configuring the Delete Record Interaction
To perform a delete operation, you must specify which Record Variable represents the data you want to remove.
Method 1: Deleting the Current Page Record
Use this method when your component is placed on a Record Page (e.g., an Opportunity Page) and you want to provide a button to delete the record currently being viewed.
1. Define the Context
Open your Dynamic Component's Settings (gear icon ⚙️).
Set the Target Page Object to the object you are working on.
Result: The
$Component.recordvariable is now active and holds the ID of the current record.
2. Configure the Interaction
Add a Button component (e.g., label it "Delete").
Add an On Click interaction.
Action Type: Select
Delete Record.Record Variable: Select Target Page Record.
Method 2: Deleting a Specific Record Variable
Use this method when you want to delete a record that is not the main record of the page (e.g., deleting a specific row from a list of related contacts, or a record fetched via a "Get Records" action).
1. Identify the Variable Ensure you have a Record Variable (e.g., selectedContact) that is currently populated with data. This is often done by:
Using an On Load > Get Records interaction.
Using an Iterator or Collection where the user selects a specific item.
2. Configure the Interaction
Add the interactive component (e.g., a "Trash" icon button inside a list or card).
Add an On Click interaction.
Action Type: Select
Delete Record.Record Variable: Select the specific variable you want to delete (e.g.,
{!selectedContact}).
Important Requirement: The Record ID
For the delete action to work, the variable you select must contain the Salesforce Record ID.
Context Record: The system automatically includes the ID.
Custom Variable: If you populated the variable using a query (Get Records) or a Flow, you must ensure the Id field was included in the retrieved data.
Best Practice: User Confirmation
Because deleting data is a destructive action, it is highly recommended to ask for user confirmation before triggering the delete.
Recommended Flow:
Button Click: Triggers an Open Modal (or Open Alert) interaction asking "Are you sure?".
Modal "Confirm" Button: Triggers the Delete Record interaction.
Navigation After Delete
If you delete the Current Page Record (Method 1), the user will be left on a page that no longer exists. You should chain a Navigate interaction immediately after the delete action to redirect the user elsewhere (e.g., back to the Object Home page or a parent record).
Example Chain:
Delete Record: (Target Page Record)
Navigate: (To Opportunity List View)
Last updated
Was this helpful?
