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
giri rockzzzzgiri rockzzzz 

how to delete all records in an custom object at once ??

how to delete all records in an custom object at once ??

Imran MohammedImran Mohammed

Have a button exposed on a object detail page or list view or in VF page.

Make the changes accordingly to the code.

 

    webservice static string deleteRecords(ID[] idList)
    {
        for(Common_Usage__c[] cuList : [select id from Common_Usage__c where id in :idList])
  {
         delete cuList;
  }
        return 'success';
    }

 

If you create button in VF page, then no need of having webservice and static keywords.

One easy way is, you can use System log and use the above code to do that. That will be much easy.