Remember how I said I’d find a way to Mass Delete error records in lightning? Well here it is! (And shown in Lightning as well, you only need to use this for Lightning as you could use the JS Button for Classic)
Step 1 – Download this from Salesforce Labs (https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016YuDEAU)
Step 2 – Clone one of the VF Pages
Step 3 – Replace this in the cloned page with the custom object you want the button to live on
Step 4 – Make new button
Step 5 – Add it to the search results
Step 6 – Mass Delete!
Side note after writing this up I see in 2.9 someone added a VF page button that does the same thing. WELL THE GOOD NEWS IS THIS WORKS WITH ANY OBJECT IF YOU HAVE ANY OTHER OBJECTS YOU WANNA ADD A MASS DELETE BUTTON TO 😉 The only difference is in editing the VF page you’d put the object API name where we put the DLRS object name and you’d most likely want to name the page something different.
Hello Dan,
Hope you are doing well.
This mass delete in lightning is great. But how to implement this for OpportunityLineItem?
Thanks,
Sachin
Probably just change the controller to OpportunityLineItem
Hi Dan,
Can you provide the page code for one of these pages? I can’t seem to be able to install this package in my dev org.
Thanks in advance!
I dont for this package anymore but you can copy/borrow the code from DLRS.
VF Page – https://github.com/afawcett/declarative-lookup-rollup-summaries/blob/master/force-app/main/pages/rollupsummarylogdelete.page
Controller – https://github.com/afawcett/declarative-lookup-rollup-summaries/blob/master/force-app/main/classes/RollupSummaryLogDeleteController.cls
How about for an already included object such as Campaigns?
Hi Dan,
Man this was great! Just created the controller and the VF page using the github code, changed it to the custom object I needed and worked like a charm!
Quick question, is there a way for that when I click the button, instead of taking me to a new page where I have to delete or cancel, it being done in a pop-up window in the list view/page where I clicked the button? Don’t have much or any coding experience in general, just an admin trying to learn here.
Thanks!!
Not sure honestly the only way I think you can do that is JS or a Lightning Component that has a JS Controller.
Never saw your reply, my bad! Will look into that option, looked around a little bit in the meantime and found that that was an option.
Thanks!
Hi!
How would I be able to create a test class for this? I’m trying to push this to our Prod environment but can’t because of code coverage, so started writing the test class (based myself on what I could find online).
Thanks!
For the VF page? Only the controller needs the test class and you use the standard controller so I’m not sure what test class you need.
It looks like this won’t work for the Task object. Anyone know of any workarounds?
I don’t sorry!
Great work, I used this code and worked like a charm. I need similar code for MassUpdate, specially having issue with updating lookup fields.
The related list is not getting updated after the delete until a refresh is done on the related list.