Flow: How To Use “Delete Records”
As “Delete Records” is one of the data element, it will have directly impact on your real records so use it carefully. There are two ways to define what records to delete:
1. Use a Record or a Record Collection
When you stored a record inside a record variable or a collection variable, the Id should automatically be saved in there as well. Then in the Delete Records element, you can directly assign that variable for deletion.
The most common case is to create a record variable that allows for input and enter it here, so when the flow is trigger, the system will catch the record Id, and then this record will be deleted
2. Specify Conditions
If you are overly cautious as I am, you might find this method safer. Here you can manually key in all the conditions for deletion, so you can double check that you are not deleting the wrong records.
In your example, say there are 10 Accounts in the COLD status, and I put them in a Record Collection Variable on the DELETE RECORDS element. Is that 1 DML or 10 DMLs?
Same question for Specifying Conditions…..
Does that result in 1 DML and 1 SOQL, or 10 DML and 10 SOQL?
I’m looking to delete 40,000 records, so this is a big consideration for me.
Hi Jen, 1 DML will be used in total. For specifying condition, it is 1 SOQL and 1 DML in total, even if you have multiple records. Hope it helps!
Hello,
I built a flow,that count me related Contact object number in the Account object when Contact object cretated or Updated.
But,now I also want update the Contact object number in the Account object when Contact object deleted.
How can I solve this case?