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
sri123sri123 

Reg: Mass Delete

Can i delete more than 1 record at a time from an object?

 

 

Please reply...

 

Regards:

REKHA

Imran MohammedImran Mohammed

Yes you can delete more than one record at a time from an object.

But you should write custom code to do that.

Imran MohammedImran Mohammed

Hi,

 

I am assuming that you wanna delete records from the list view based on selection.

 

In the List button javascript code, add this

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}

{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}

var selectedRecords =  {!GETRECORDIDS( $ObjectType.Common_Usage__c )};

var result = sforce.apex.execute('CommonUsageController','deleteRecords',{arg: selectedRecords});

-------------------------------------------------------------------

 

 

You should create a global class and add this method to it.

 

    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';
    }
Let me know if you face any issues.