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
subaasubaa 

How to display a confirmation dialog box on click of delete button in standard object record?

Hi,

 

Is there, any way to display the confirmation dialog message box, upon deleting a Standard object record. The dialog box will display or not, upon the decision made in that object trigger code (using before Delete event).

 

Thanks in advance.

 

Regards,

SuBaa

cloudmaniacloudmania

There are alot of workaround to achieve this.But need some clarification,Do you delete the record in Trigger? The delete button is standard or a custom button?

Navatar_DbSupNavatar_DbSup

Hi,

 

I think this is not possible through trigger you can override your delete button and display the confirmation and on the basis of the confirmation perform the delete operation by using Ajax calling.

 

For ajax Clling try the below code:

 

Class code

global class deletecontact
{

WebService static void deletecontactmethod(string contactid)
{
contact cc=new contact(id=contactid);
delete cc;
}
}

 

Delete Button code

 

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js")}



sforce.connection.sessionId="{!$Api.Session_ID}";
var answer=var answer = confirm ("Are you sure?");
if(answer)
{
sforce.apex.execute("deletecontact","deletecontactmethod",{contactid:"{!contact.Id}"});
}

window.location.href = '/home/home.jsp';

 

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

 

subaasubaa

Jain,

 

Could you please assist me, to where I can place Delete button code? I could see 'Visualforce page' and 'custom S-Control' options for Override With property of edit page of Delete button.

 

Regards,

SuBaa

subaasubaa

Erkan,

 

Yes, I planned to have delete code in trigger. ie, the decision will made in trigger to delete that Account once the Delete buttion is clicked. And it is standard 'Delete' button only. Is there any issue to fire trigger from standard button? Please advise.

 

Regards,

SuBaa