Tool to purge UsageData

  • 1
  • Idea
  • Updated 1 year ago
  • Under Consideration
We've moved to Scorecard 2.0 and no longer need the data in the UsageData object. In order to get rid of that data, we have to use DataLoader and hard delete. That's do-able, but time consuming.
I tried using Truncate, but it's not an option for custom objects in managed packages.
I'd like a tool to remove all data from UsageData so I don't have to do that manually.
Photo of Amber Boaz

Amber Boaz

  • 102 Points 100 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Azhar Uddin

Azhar Uddin, Employee

  • 3,932 Points 3k badge 2x thumb
Hi, 
You want to delete all records and make UsageData object empty or just the scorecard measure in UsageData empty ?

Thanks 
Photo of Amber Boaz

Amber Boaz

  • 102 Points 100 badge 2x thumb
Delete all records in the UsageData object.
Photo of Scott Morris

Scott Morris, Alum

  • 6,312 Points 5k badge 2x thumb
Yep this will work, however you'll need to add a LIMIT 10000 clause as SFDC only allows 10k records to be deleted at a time.
Photo of Amber Boaz

Amber Boaz

  • 102 Points 100 badge 2x thumb
Right, and we have +-24million records in UsageData right now. 
Only 2400 times! :-)
Photo of Azhar Uddin

Azhar Uddin, Employee

  • 3,932 Points 3k badge 2x thumb
Ouchh.. !! You will need a script that deletes in batches

:(
Photo of Scott Morris

Scott Morris, Alum

  • 6,312 Points 5k badge 2x thumb
Amber what I'd do is use workbench to export all records (choose bulk csv option) from the Usage Data object.  You can then run a delete job directly from Workbench using SFDC's Bulk API which batches them for you in 10k jobs.

All you'll need to do is map the Id in the file to Id in the delete option.  If you have any questions, please let me know.
Photo of Amber Boaz

Amber Boaz

  • 102 Points 100 badge 2x thumb
Because of the data volume, Workbench times out on me when I try to pull this many records.
As best I can tell our only option is to use the DataLoader.