+ Start a Discussion
Paula Kern 4Paula Kern 4 

button on custom page to redirect to opportunity tab

Hello, I'm a development newbie and I have a custom VF page that i need to add a button to that will redirect me to the Opportunity tab.  Any help would be appreciated.  
Best Answer chosen by Paula Kern 4
Pradeep SinghPradeep Singh
Hi Paula, Refer code below
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockButtons >
            <apex:commandButton value="Redirect" action="{!redirectToOpp}"/>
        </apex:pageBlockButtons>
    </apex:pageBlock>
</apex:form>

-----------controller method--------


public pageReference redirectToOpp(){
        pageReference pg = new pageReference('/006');
        return pg;
    }

All Answers

Pradeep SinghPradeep Singh
Hi Paula, Refer code below
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockButtons >
            <apex:commandButton value="Redirect" action="{!redirectToOpp}"/>
        </apex:pageBlockButtons>
    </apex:pageBlock>
</apex:form>

-----------controller method--------


public pageReference redirectToOpp(){
        pageReference pg = new pageReference('/006');
        return pg;
    }
This was selected as the best answer
Paula Kern 4Paula Kern 4
Thank you so much Pradeep.  Perfect.  Thanks for the help.  Start my dev class in June.