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
Robert Davis 16Robert Davis 16 

Need Pop Up Message for User When the Press New Opportunity Button - Need Idea

The requirement that I have been given is to display a Popup Window when user presses the New button to create an Opportunity. Then depending on the answer redirect to a different page.

I tried to do create a "new" New Opportunity button but can not replace on the Home Opportunity List View. What is the best approach for this?

We are using Salesforce Classic.

Thanks in advance,

Robert
Best Answer chosen by Robert Davis 16
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Robert,
  • To Set up an Alert on the “New” opportunity button.
  •  You can override the Standard new button to take to a vf page that simply shows a message "You must create an opportunity from the Account" or something similar. You then remove the standard new button everywhere you can and replace with your custom New button. For those places where you cannot remove the new button the VF page would be displayed.
  • https://salesforce.stackexchange.com/questions/81295/set-up-an-alert-on-the-new-opportunity-button
Hope it helpful.

Regards
Rahul Kumar

All Answers

Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Robert,
  • To Set up an Alert on the “New” opportunity button.
  •  You can override the Standard new button to take to a vf page that simply shows a message "You must create an opportunity from the Account" or something similar. You then remove the standard new button everywhere you can and replace with your custom New button. For those places where you cannot remove the new button the VF page would be displayed.
  • https://salesforce.stackexchange.com/questions/81295/set-up-an-alert-on-the-new-opportunity-button
Hope it helpful.

Regards
Rahul Kumar
This was selected as the best answer
Robert Davis 16Robert Davis 16
Rahul,

Great minds think alike that is exactly what I did, with just a little bit of an exception. I created an extension that redirected the page back to New Opportunities using the following code once the user saw the information I wanted them to:
 
public class RedirectOppExt {
    
    public RedirectOppExt(ApexPages.StandardController controller){
    
    }
    
    public PageReference NewOpp(){
        
        PageReference pr = new PageReference('/006/e?nooverride=1');
        pr.setRedirect(true);
        return pr;
    }
    
}

The key was to let them create the Opportunity once they read the visuaforce page. It took me a while to realize that I could place a  "?nooverride=1" on the end of the url so I did not create a loop.

I also used the link you reference as a help.

Thank you so, much for replying.