function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Binh PhuBinh Phu 

How to delete custom object programmatically

Good morning everyone,
I am new to SF and I'd like to know how can I delete a SF custom object programmatically?  Currently I am manually going to custom object itself and manually truncate it.
Thank you for your advise.

Regards,
Binh
bob_buzzardbob_buzzard
You would need to use the metadata api for this, you can't do it via Apex I'm afraid.
Ajay K DubediAjay K Dubedi
Hi Binh,
The Force.com platform provides a rich and powerful metadata model and Metadata API. Platform metadata describes your application and the API encompasses a set of methods that provide programmatic access to the configuration and source of your application. The Meta data API in salesforce is a perfect soultion for this. The following link gives a good example to learn how to do Metadata changes programatically.
https://developer.salesforce.com/page/An_Introduction_to_Force.com_Metadata 
Binh PhuBinh Phu
Thank  you everyone.  I will read those documents.

Have a great one!