Mass Delete Salesforce Records Using Flow

Business Use Case: There is a custom field “IsActive” on “Contact” object. The Admin user wants to delete all inactive Contacts from “Account” record.

Here I’ve created a flow and the flow is invoked by a Custom Button, and that Custom Button is configured on Account object page layout. User will be able to access in both Classic & Lightning experience.

1. Go to Setup | Quick Find – Search Flows – Click Flow | New Flow

2. Create a variable as “varAccountId”

3. Create a sObject Collection Variable as “varCollectionOfContacts”

4. Create a Fast Lookup to get inactive Contacts with Account Id

5. Create a Decision to check Account has available inactive contacts.

6. Create Fast Delete to delete Contacts

8. Set the Fast Lookup as a starting element, indicated by the green down arrow. Then, connect the flow element “Fast Lookup” to “Decision” and “Decision” to “Fast Delete”.

9. Activate the created flow.

10. Create a Custom Button on “Account” object to invoke the Flow with AccountId parameter.

11. Add above created Custom button into Account page layout.