Salesforce Developer Tutorial - How to Mass Delete Records using Apex

  Рет қаралды 2,766

Coding With The Force

Coding With The Force

Күн бұрын

Пікірлер: 11
@CodingWithTheForce
@CodingWithTheForce Жыл бұрын
Make sure prior to mass deleting records that this is your employers desired end state for these records, and that they wouldn't prefer to archive/offload them to another system!
@sagarr7940
@sagarr7940 9 ай бұрын
Very clean and clearly explained. Thanks for your inputs 🙏
@cassioorsi
@cassioorsi Жыл бұрын
Good stuff. I got kinda confused when you queried for the records and then deleted them. I thought the enqueue afterwards wouldn't work because in my head the list of cases would be empty after they got deleted. But in reality the original list in memory still holds the copies of the records.
@pedroprada1
@pedroprada1 Жыл бұрын
great video.. you are a natural... thank you!
@robinkorver7756
@robinkorver7756 Жыл бұрын
Any suggestions on how to handle any related records that also need deleting? (In a composable/scalable way, hopefully preventing hardcoding)
@DanielSoileau
@DanielSoileau Жыл бұрын
Hard to answer without knowing the org/requirements. I think you'd want some level of hard coded definition of what you're trying to delete, so it doesn't run rampant. If you have multiple objects with similar requirements, you could make the code generic (with safe guards) and pass in the target object/age (with safe guards) as a parameter to use in a dynamic query during each run. Or you can delete the children before deleting the parent all in the same transaction's execute, just watch the DML limit if spanning multiple objects in large batches. You can also consider using the build in cascade delete feature of the master/detail or lookup relationship fields to handle cleanup.
@IlaNaveen
@IlaNaveen Жыл бұрын
We can also use flows to delete the records.
@DanielSoileau
@DanielSoileau 11 ай бұрын
I wanted to use flow, but unfortunately there is no LIMIT option when performing a get query in flow. If your get query returns more than 50k results or your delete tries to delete more than 10k records, it will fail.
@lahcenlamkirich5174
@lahcenlamkirich5174 Жыл бұрын
Is there really a way to reset the org data l? ike what you did in 11:58 ... Thanks !
@DanielSoileau
@DanielSoileau 11 ай бұрын
Except for the org's recycle bin, not exactly. That's why you always want to do thorough testing and keep backups as a last resort. This "reset" was really re-inserting sample test data using a couple of anonymous apex executions.
@ibbiesantaloci2683
@ibbiesantaloci2683 Жыл бұрын
☹️ *PromoSM*
Salesforce Developer Tutorial - The Complete Guide to Apex Tests in 2024
1:45:37
Coding With The Force
Рет қаралды 7 М.
Salesforce Developer Tutorial (LWC) - The Complete Guide to LWC Lifecycle Hooks
45:56
СОБАКА ВЕРНУЛА ТАБАЛАПКИ😱#shorts
00:25
INNA SERG
Рет қаралды 3,6 МЛН
Perfect Pitch Challenge? Easy! 🎤😎| Free Fire Official
00:13
Garena Free Fire Global
Рет қаралды 79 МЛН
Wait… Maxim, did you just eat 8 BURGERS?!🍔😳| Free Fire Official
00:13
Garena Free Fire Global
Рет қаралды 9 МЛН
I Failed the Salesforce CTA Board AMA - Matt Gerry
1:28:37
Coding With The Force
Рет қаралды 2,1 М.
Salesforce Developer Tutorial (LWC) - The Complete Guide to LWC Jest Tests in 2023
2:16:25
programming daily #47 - 2024 10 31
36:16
Piotr Justyna
Рет қаралды 10
Salesforce Developer Tutorial - The Complete Guide To Apex Triggers in 2022
2:09:40
Crash course on Apex Triggers Salesforce | Complete guide with Real time scenarios
2:35:05
СОБАКА ВЕРНУЛА ТАБАЛАПКИ😱#shorts
00:25
INNA SERG
Рет қаралды 3,6 МЛН