Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete more than one record at a time in salesforce?

How do I delete more than one record at a time in salesforce?

like image 369
suman Avatar asked Dec 28 '22 02:12

suman


1 Answers

Delete all Salesforce Account objects (up to the artificially imposed limitations per SF query on whatever the object happens to be):

delete new List<Account>([select Id from Account]);

Where "Account" is any Salesforce object (or custom object you've created). You can fine-tune the delete by adding the "WHERE" clause:

delete new List<Account>([select Id from Account where ... ])

Or the "LIKE" clause:

delete new List<Account>([select Id from Account where LastName like 'Jon%']);
like image 130
jerhewet Avatar answered Mar 08 '23 15:03

jerhewet