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: Delete Records

Hi,

I would like to delete all selected records at a time with in a List.

please send the code regarding to this.

 

Regards:

sri

 

Ispita_NavatarIspita_Navatar

The following is sample code for a custom button which mass deletes records:-

 

 

// Include and initialize the AJAX Toolkit javascript library
//
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
// Get the list of accounts that should be deleted.
// Use the $ObjectType merge field to indicate the type of
// record Ids that are expected.
//
var idsToDelete = {!GETRECORDIDS( $ObjectType.Lead)};
var deleteWarning = 'Are you sure you wish to delete ' +
idsToDelete.length + ' leads—';
if (idsToDelete.length && (window.confirm(deleteWarning))) {
// Delete the records, and pass a function into the call
// so that the toolkit refreshes the current page
// asynchronously when the call succeeds.
//
sforce.connection.deleteIds(idsToDelete,
function() {navigateToUrl(window.location.href);});
} else if (idsToDelete.length == 0) {
alert("Please select the leads you wish to delete.");
}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.