Given a list of Contact records, attempt to delete them using Database.delete with the allOrNone parameter set to false. This allows partial success - some records may delete successfully while others may fail. Return a Map with two keys: success containing the count of successfully deleted records, and failed containing the count of failed deletions. Handle null or empty input lists by returning zeros for both counts.
Examples:
Input: contacts = [Contact1, Contact2, Contact3] (all deletable)
Output: {'success': 3, 'failed': 0}
Explanation: All 3 contacts were successfully deleted
Input: contacts = null
Output: {'success': 0, 'failed': 0}
Explanation: Null input returns zero counts for both success and failed
Input: contacts = []
Output: {'success': 0, 'failed': 0}
Explanation: Empty list returns zero counts for both success and failed
Welcome to Lightning Challenge!
How It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
Contest runs October 4 - 15. Complete challenges to climb the leaderboard!
Prizes 1 & 2: Salesforce certification exam voucher — won by random drawing, where every point is a ticket. see all prizes
Only the 12 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.