+ Start a Discussion
David.HEDavid.HE 

Emulate 'Edit' button for Opportunity page

I want to add a validation before one user edit an opportunity.

I have created a new custom button and I want to show an alert and after it  open the opportunity in edit mode.

 

I have googled a lot of time and I don't find anything.

 

Any help in how to achive that?

 

 

Thanks,

Best Answer chosen by Admin (Salesforce Developers) 
Dhaval PanchalDhaval Panchal

Try this....

 

Create one Opportunity Detail button (javascript).

 

and add below code in javascript editor.

 

alert('Redirecting to edit page.'); //Give your validation message here.

window.location = location.protocol+'//'+location.host+'/{!Opportunity.Id}/e?retURL=/{!Opportunity.Id}';

 

Give name "Edit" to this button. Then add this button to page layout (remove standard edit button).