EP - 08 | DELETE ACCOUNTS FROM SALESFORCE USING FLOW | LIGHTNING FLOW SERIES ⚡️

 


Delete Record Element

In this Blog you will learn about a very useful data element in salesforce flow which is Delete Record Element. This element will work same as Delete Statement that we use in SOQL but in that you have to write the Delete query and here it is much easier and you can delete records from objects without writing any line of code. Isn't it great right?

Use Case :
Create a flow and fetch Accounts with Active='yes' and their Industry should be 'Construction'. After that delete all those accounts using Delete Record Element.

For this use case we are using our previous example flow in which we have fetched all the records using get records element. If you want to checkout that video/tutorial then click here
Here is the final look of that previous example :


Now we have all the accounts with above conditions fetched in this get record element. We will drag a delete record element on the canvas.
Have a look :


Here we have given Label and Api Name to the element. After that you can see there are two options from which we have selected the first one.
The options are for 
How to Find Records to Delete - That means how the element will find which records we want to delete.

When to use the first Option?
If you have your records in any record collection variable then you will choose the first option and after that you will add you record/record collection name below that.
In our case we have our records fetched in the get record element which is also a collection of records so we have written our get record element name here.

When to use the second option?
If you have not fetched your records and then you can choose the object with the desired conditions directly in the Delete Record Element and delete the records.
Have a look :


If we do not fetch data in the get record element we can directly add Object name and Conditions here as well.

For detailed tutorial checkout this youtube video :



If you have any question please leave a comment below.

If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !

Thanks
Let's learn and grow together.
Love and Peace! 🧡

Post a Comment

0 Comments