You need to sign in to do that
Don't have an account?
mgodsey
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);
}
}
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);
}
}
All Answers
Here is post that has more information on using Record types & Visualforce pages https://developer.salesforce.com/forums/ForumsMain?id=906F000000095W3IAI