+ Start a Discussion
mgodseymgodsey 

VF page to replace standard record type selection page

Has anyone successfully created a VF page to replace the standard record type selection page?

I have two record types for the standard Quote object. Rather than having the user use the standard record type selection page when they click "New Quote", I want them redirected to a VF page. On this VF page there will be two buttons - a button called "Proposal" to create a Quote with record type A, and one called "Insertion Order" to create a Quote with record type B.

I've tried reading the previous posts about this, but most are from a few years ago and don't seem to offer working solutions.

I've created a page and controller extension, but it is only working if I hardcode in the Opportunity ID. Is there going to be any way for me to get this Opp ID programmatically? Thank you!

VF Page
<apex:page standardController="Quote" extensions="NewMediaPlanExtension" recordSetVar="quotes">
    <apex:form >
        <p style="font-size:25px"> What type of Media Plan are you creating?</p>
        <br/>
        <apex:commandButton action="{!newProposal}" value="Proposal"/>
    </apex:form>
</apex:page>

Controller
public with sharing class NewMediaPlanExtension {
public ApexPages.StandardSetController sController{get;set;}

public NewMediaPlanExtension(ApexPages.StandardSetController controller){
  sController = controller;
}

public PageReference newProposal(){
  String prefix = Quote.SObjectType.getDescribe().getKeyPrefix();
  String param = 'oppid=006S00000070yVM&RecordType=012S00000004fib';
  return new PageReference('/'+prefix+'/e?noovverride=1&' + param);
}

}

Best Answer chosen by mgodsey
Here-n-nowHere-n-now
Are you putting the "New Quote" button on an Opportunity page?  If so, why don't you get the opty Id with {!Opportunity.Id} in the button code and pass it to the VF page as part of the query string (for instance ?opid={!Opportunity.Id})?  Once your VF extension has the Id, it can be used as part of the Quote edit URL.

All Answers

Here-n-nowHere-n-now
Are you putting the "New Quote" button on an Opportunity page?  If so, why don't you get the opty Id with {!Opportunity.Id} in the button code and pass it to the VF page as part of the query string (for instance ?opid={!Opportunity.Id})?  Once your VF extension has the Id, it can be used as part of the Quote edit URL.
This was selected as the best answer
Ramu_SFDCRamu_SFDC
Hi,

Here is post that has more information on using Record types & Visualforce pages https://developer.salesforce.com/forums/ForumsMain?id=906F000000095W3IAI