+ Start a Discussion
Leticia Monteiro FreitasLeticia Monteiro Freitas 

How is the most efficiente way to clean up a org?

I want clean all the data in my org. How is the easiest way to do this?
Best Answer chosen by Leticia Monteiro Freitas
Alain CabonAlain Cabon
The idea could be a generated list of delete orders in apex based on all the existing not empty objects launched from the Anonymous console.

delete [ select id from Account limit 10000 ];
delete [ select id from myObject1__c limit 10000]:
...
delete [ select id from myObject20__c limit 10000]:

because of the limit of 10000 records, you just relaunch the all list of delete orders until all your objects are empty. 

 That is the most easy way but if you have hundreds of thousands records you need to use another technique.

All Answers

Alain CabonAlain Cabon
Hi,

What do you mean by "cleaning" the data?  
 
Leticia Monteiro FreitasLeticia Monteiro Freitas
Hi Alain, 

I want erase all the data in my org. How Can i do that?
 
Leticia Monteiro FreitasLeticia Monteiro Freitas
Yep, a thousands of records
Alain CabonAlain Cabon
The idea could be a generated list of delete orders in apex based on all the existing not empty objects launched from the Anonymous console.

delete [ select id from Account limit 10000 ];
delete [ select id from myObject1__c limit 10000]:
...
delete [ select id from myObject20__c limit 10000]:

because of the limit of 10000 records, you just relaunch the all list of delete orders until all your objects are empty. 

 That is the most easy way but if you have hundreds of thousands records you need to use another technique.
This was selected as the best answer
Alain CabonAlain Cabon
From the "Setup",  quick search "Storage Usage" , and you will see all the counts of records for all your objects not empty.

View your Salesforce org’s storage limits and usage from the Storage Usage page in Setup.
https://help.salesforce.com/articleView?id=admin_monitorresources.htm&type=5

What is the biggest object in records? 

You have also the "Mass Delete Records" for some standard object from the "Setup".

1) From the (setup) "Object manager" (lightning): copy/paste all the object list in Excel
2) Copy paste all the list of object from (setup) "Storage Usage" to know the not empty object
3) generate the list of deletion orders from Excel:    ="delete [ select id from " & A1 & " limit 10000 ];"
4) Developer console  and CTRL + E (anonymous window): paste all the deletion orders