Monday, 31 October 2011

Mass Delete Button for Standard and Custom objects.

i created  custom button(Mass Delete)  for standard and custom objects.Using Data loader only Delete the all records in custom objects but i created Custom button for Delete all the records in custom object. select all the records click on  Mass Delete  button then Deleted all the records at a time.
This is very useful code working perfectly

Mass Delete.
========
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}

var idsToDelete = {!GETRECORDIDS( $ObjectType.Contact )};
var deleteWarning= 'Are you sure you wish to delete ' +idsToDelete.length+ ' Records?';
if(idsToDelete.length&& (window.confirm(deleteWarning)))
{
sforce.connection.deleteIds(idsToDelete,function()
{navigateToUrl(window.location.href);
});
}
else if (idsToDelete.length == 0)
{
alert("Please select the contacts you wish to delete.!!");
}

No comments:

Post a Comment

Post a Comment