You need to sign in to do that
Don't have an account?
John Neilan 2
Redirect to Visualforce Page After Record Type Chosen
Hello,
I am trying to redirect users to a VF page after the record type is chosen when creating a new Case. If a particular Record Type is chosen, the use should be brought to a VF page, anything else should default to the normal behavior after a Record Type is selected. I have the VF page below overriding the New bustton on Cases, and the controller to go with it. The users are being re-directed to the VF page, but the other part is not working as it is still remaning on the VF page re-direct. Can anyone help me get the default behavior in the controller? Thanks,
VF Page:
Controller:
I am trying to redirect users to a VF page after the record type is chosen when creating a new Case. If a particular Record Type is chosen, the use should be brought to a VF page, anything else should default to the normal behavior after a Record Type is selected. I have the VF page below overriding the New bustton on Cases, and the controller to go with it. The users are being re-directed to the VF page, but the other part is not working as it is still remaning on the VF page re-direct. Can anyone help me get the default behavior in the controller? Thanks,
VF Page:
<apex:page standardcontroller="Case" extensions="VF_Controller_CasePgLayout" action="{!CaseRedirect}"/>
Controller:
//Controller to Override Case creation public with sharing class VF_Controller_CasePgLayout{ public Case c1; public VF_Controller_CasePgLayout(ApexPages.StandardController myController){ this.c1 = (Case)myController.getRecord(); } public PageReference CaseRedirect() { if(c1.RecordTypeId =='012L0000000DPwQ'){ PageReference pageRef = new PageReference('/apex/VF_CaseDetail'); return pageRef; } else{ PageReference pageRef2 = new PageReference('/500/e?retURL=%2F'+c1.AccountId+'&def_account_id='+c1.AccountId+'&RecordType='+c1.RecordTypeId+'ent=Case'); return pageRef2; } } }
The error is:
Any idea?
but here is how i got mine to work
PageReference outpage = this.controller.edit();
//you can do some logic in here in case the recordtype selected needs to go to a visualforce page or whatever, just change the value of outpage
//after all the logic, you should do this
for(string key : System.currentPageReference().getParameters().keySet()){
if(!key.equalsIgnoreCase('view') && !key.equalsIgnoreCase('sfdc.override') && !key.equalsIgnoreCase('id')) {
outpage.getParameters().put(key, System.currentPageReference().getParameters().get(key));
}
}
outpage.getParameters().put('nooverride','1');
outpage.setRedirect(true);
return outpage;