See if you are using a controller with the visualforce page then you can use wrapper classes. In wrapper class you can add a checkbox with the records, and each time a checkbox is checked and clicked for deletion then you can do this via wrapper class and no need to pass the Param from VFP.
If you are using standard controller then it can be done on the page itself, otherwise not able to understand why you don't want to use the param as in any approach like actionfunction or JSRemoting or any other I think you've to pass the param.
Hi Anoop, use this <script src="/soap/ajax/20.0/connection.js" type="text/javascript"></script> <script> function delrec(conid){ sforce.connection.sessionId = "{!$Api.Session_ID}"; var contact = new sforce.SObject("Contact"); contact.Id = conid;
var delResult = sforce.connection.deleteIds([contact.Id]); if (delResult[0].getBoolean("success")) { alert("account with id " + delResult[0].id + " deleted"); } else{ alert("failed to delete account " + delResult[0]); } } </script>
pass the id which record you want to delete for Contact Or Any other object Create that Sobject first and use deleteids to delete that particular record.
Am still keem to know why he don't want to send the ID in param, as by this also he is sending the ID to function which is equivalent to sending the ID to action function. Also it will consume an API hit.
use this
<script src="/soap/ajax/20.0/connection.js" type="text/javascript"></script>
<script>
function delrec(conid){
sforce.connection.sessionId = "{!$Api.Session_ID}";
var contact = new sforce.SObject("Contact");
contact.Id = conid;
var delResult = sforce.connection.deleteIds([contact.Id]);
if (delResult[0].getBoolean("success")) {
alert("account with id " + delResult[0].id + " deleted");
}
else{
alert("failed to delete account " + delResult[0]);
}
}
</script>
pass the id which record you want to delete for Contact Or Any other object Create that Sobject first and use deleteids to delete that particular record.