Deleting archived tasks to clear space
I ran into storage space issues on my Full Sandbox. On inspecting Storage Usage, I found that Task records were taking up the bulk of storage. There are around 100 K Task records. Also when I run the query - Select count() from Task - it returns zero records. So my assumption is that all of these tasks are archived.
I need to delete these archived Tasks, but I 'm running into road blocks. These are the approaches I have tried -
- Mass Delete option from the UI. This will delete 250 records in one shot. This is going to be very cumbersome considering I have 100k records
- Wrote a Batch Apex class to delete tasks. But am unable to retrieve archived Tasks. The query - 'Select Id from Task limit 50000 all rows' - always returns zero records. I read that queryAll( ) is the way to go to retrieve archived records, but is there a way to use queryAll in a Batch Apex class?
- DataLoader - this seems to be the fastest way to delete records, in combination with the Bulk API. But the same problem of retrieving archived tasks exists here too. There are zero rows exported I export Task using this tool. I read somewhere that archived records can't be exported using DataLoader ?
What are the alternatives that I have ? Please advise.