You need to sign in to do that
Don't have an account?
Sweta Agnihotri
Showing Popup on delete of a Task record
Hi,
As you are aware that when we delete a record, we get a pop-up (salesforce's standard functionality) which confirms that if we really want to delete the record.
However, if you delete a Task you don't get any pop-up. So we wanted to show the pop-up on task delete event as well.
I implemented this requirement by overriding the "Delete" button with a Visualforce page.
Within the visualforce made use of AJAX.
<apex:page standardController="Task"> <script type="text/javascript"> var __sfdcSessionId = '{!GETSESSIONID()}'; </script> <script src="../../soap/ajax/20.0/connection.js" type="text/javascript"></script> <script type="text/javascript"> window.onload = loadOnClick; /* Function Name : gup Description: To get the value of a parameter in the URL */ function gup( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp(regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } /* Function Name : gup Description: Gets called on Delete button click. */ function loadOnClick() { try{ var answer = confirm('Delete the Record?'); var taskRecordId = gup('delID'); if(answer) { var delResult = sforce.connection.deleteIds([taskRecordId ]); window.location='/home/home.jsp'; }else { window.location='/'+taskRecordId; } }catch(err) { alert(err); } } </script> </apex:page>
did you have any problem with that?
and also i see that for getting the taskrecordid you have written a function instead you can simply do this
var taskRecordId = '{!Task.Id}';
instead of
var taskRecordId = gup('delID');
Hi,
I dont have any issues, just wanted to share the code with entire community.
Thanks
I have tried the same code. But its not working :(