• Matt Field 24
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
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);
    else
        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}">
</apex:page>

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?

Thanks,

Matt