In Salesforce, using the record-trigger flow, we can automate the process of deleting records that do not meet the required criteria.
In this Salesforce tutorial, we will learn how to delete records using flow in Salesforce, using real-time scenarios and step-by-step explanations.
Delete Record using Flow in Salesforce
While working as a Salesforce Admin for a US-based Organization that provides software solutions, I was assigned the task of if we get any opportunity in the “Close Lost” stage, then that opportunity should get deleted automatically.
To create this process automatically, we can create a record trigger flow, which will trigger on the opportunity stage changes into Close Lost, and then that record gets deleted. This will be useful to the organization for deleting records that do not meet business criteria or are not required.
Delete Records using Flow in Salesforce
Using the above scenario and the following steps, we can delete records using Salesforce Flow.
1. Log in to Salesforce Org. -> Click on the Setup -> Home Tab -> In Quick Find Box, Search for Flows. You will see an option under Process Automation -> Click on Flows.

2. Then, click on the New Flow button to create a new flow.

3. We know the record trigger flow launches when the record is created, updated, or deleted. When the opportunity stage is updated or changed to “Close Lost,” the record will be deleted. To do that, we have to select the Record Trigger flow and click on the Create button.

4. As we click on the create button, we will see the flow canvas. In our scenario, the flow should trigger when we update the Opportunity record, so I selected the Opportunity in the Object field.
In Configure Trigger, I have selected A Record is Updated because when we Update the opportunity stage to “Close Lost” the record, the flow should trigger.

5. Then, we have to Set Entry Conditions, and in the Condition Requirement option, we have to select All Conditions Are Met(AND) because the following condition should meet the criteria.
Our triggering condition is when StageName is equal to “Close Lost.” Then, the trigger should fire.
Then we need to select Every time a record is updated and meets the condition requirements: When you select this option, every time you update the record, the flow will trigger.
We are going to update the opportunity records and want to delete those records whose oppo stage is close lost, so we have to select Optimize the Flow for Action and Related Records.

6. Now, we need to add the Delete Record element. To Add Element, click on the + plus icon, and then under the Data component, you can see Delete Record. Click on it.
When we click Delete Records, we have to enter the Label, which will display on the flow canvas. The API Name will automatically populate.
7. Then, we need to select How to Find Record to Delete. Here, we need to provide the current RecordID to the Opportunity ID. For that, select Specify Conditions, and in the Object field, select Opportunity object.
Then, specify the current RecordID to the Opportunity ID.

8. After setting up all labels and conditions, first save the flow. You can see the Save button. Click on it and then click on the Debug button. Then click on the Activate button; always remember to debug the flow before activating it. It’s good practice to use flow.

9. Then, click the Save button to save the flow. For that, we need to enter the Flow Label; here, I have entered Delete records for specific conditions. The API Name will automatically populate as we click the text box. The Description is optional; we can introduce our flow Shortly.

10. After that, to check whether the flow is working, go to the Opportunity record and try to update any oppo stage “Close Lost,” and then Save the changed record. Then, go to the Recycle Bin to see the deleted record.

11. As you navigate to the Recycle Bin, you will see which record you have updated to close the lost stage in the opportunity object. That record is deleted and stored in the recycle bin.

This is how we can delete the records using flow in Salesforce.
Conclusion
I hope now you have an idea about how to delete conditional records that are not required by the business criteria. In that, we have seen how to delete records using flow in Salesforce with scenario and explanation.
You may like to read:
- How to Delete Related Records Using Flow Action in Salesforce
- How to Clone a Record with Flow in Salesforce
- How to Delete Custom App in Salesforce?
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.