+ Start a Discussion
Matt Field 24Matt Field 24 

Problem getting Visualforce page to reflect opportunity record type

I am creating 3 visualforce pages for creating new opportunities (I have 3 separate record types).  I found the following apex class that determines what record type was selected and goes to the appropiate VF page (only testing with 2 of them right now):
public class NewOppDispatcher {
public NewOppDispatcher(ApexPages.StandardController sc) {

public PageReference redirectToPage() {
    String selectedRecordType = ApexPages.currentPage().getParameters().get('RecordType');
    if (selectedRecordType == '01280000000GGZI')
        return Page.Dev_Opps.setRedirect(true);
        return Page.Create_Management_Opp.setRedirect(true);
I'm using this class along with this "traffic controller" vf page:
<apex:page standardController="Opportunity" extensions="NewOppDispatcher" action="{!redirectToPage}">

The problem I am running into is that the Opportunity Record type that is selected is not being reflected on the Visualforce page, rather the VF page is using whatever my default opportunity record type is.  Does anyone have any idea how to push the record type down to the page?



my guess would be that is youre using something like new opportunity(); it will use the default. but if you could use new opportunity(recordtypeid=seelctedRecordType); that the record type shoudl take effect.