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
VVNRAOVVNRAO 

Reg: Mass Delete

-> In salesforce how can we delete more than one record (of a custom object) at a time by using Mass Delete option?

(give clear idea about creating mass delete button ..........................until record deletion....)

 

 

Please reply..........

 

Regards:

VVNRAO

Ispita_NavatarIspita_Navatar

Try the following sample code:-

 

{!REQUIRESCRIPT("/soap/ajax/11.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/11.0/apex.js")}
var errnum = 0;
var errmsg = "";
var idArray = {!GETRECORDIDS($ObjectType.Account)};
if (idArray[0] != null) {
var records = sforce.connection.retrieve("Id,Name,Email", "Account", [idArray]);
if (records.length > 0) {
for (var i = 0; i < records.length; i++)
{
//now delete the example account
var delResult = sforce.connection.deleteIds([records[i].id]);
if (delResult[0].getBoolean("success")) {
log("account with id " + result[0].id + " deleted");
} else {
log("failed to delete account " + result[0]);
}
}
}
}
else {
alert("Please select at least one record.");
}

 

 

 

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