What is the simplest and fastest way to delete all records from a custom object? Do it from Developer Console by writing a few lines of Apex Code. Right? Well not really. To delete all records from a custom object, just navigate to the custom object definition, click on ‘Truncate’ and that’s it.
![Delete all Records from Custom Object](https://amazon.asagarwal.com/images/delete_all_records_from_custom_object.png)
For the ‘Truncate’ option to show on custom object, do not forget to check ‘Enable Custom Object Truncate’ from Setup -> Customize -> User Interface as shown below
![Enable Custom Object Truncate](https://amazon.asagarwal.com/images/enable_custom_object_truncate.png)
Points to Note
- ‘Truncate’ button is only available in Classic and won’t be visible in Lightning Experience (LEX)
- If you don’t see the ‘Truncate’ button on custom object, then please review the article ‘Truncating Custom Objects’ as mentioned below
- For safety reasons, I will recommend keep the checkbox unchecked Production Environment.
References & Useful URLs
- Truncate Custom Objects – Help Article (5 mins) – https://help.salesforce.com/articleView?id=dev_object_trunc.htm&type=5
- Truncating Custom Objects – Help Article (5 mins) – https://help.salesforce.com/articleView?id=dev_object_trunc_overview.htm&type=5
I totally forgot about this. Thanks Ashish.
My pleasure Gustavo! 🙂
Nice Information