Delete Confirmation Popup

Have you ever overridden the View page of an object but still wanted the Delete functionality? Well, Salesforce has a Javascript function you can utilize to make implementing the original Delete confirmation box extremely simple.

[html]

[/html]

When you click a button like above, you will get a popup that looks like:

The reason this popup occurs is because of the onClick event.

[js]
onclick=”return confirmDelete();”
[/js]

It utilizes a function that appears in the main.js file.

[js]
function confirmDelete(a){
a||(a=LC.getLabel(“Global”,”are_you_sure”));
return Modal.confirm(a)
};
[/js]

This is a file that is provided by Salesforce by default. This will allow you to utilize more built in Salesforce functionality and keep a consistent experience for the end user.

Note: Salesforce can change their Javascript file at any time. While this has not changed in the years I have been working on Salesforce, it is not guaranteed functionality and should be used with caution. Good luck!

Advertisement

Go to Smartblog Theme Options -> Ad Management to enter your ad code (300x250)

Comments are closed.