You need to sign in to do that
Don't have an account?
DevSF
Redirect visualforce page based on record type.
Hi friends,
My requirement is to redirect my page to a visualforce page when i select a particular record type. and it should autopopulate some fields from its parent object.
Example: My visualforce page is on Contact object and after i choose a record type it should redirect to a new visualforce page with address fields on contact object auto populated from Account object.
I have tried working on this with the help of some Blog's.. But it didn't worked the way i want.
So can anyone suggest the exact way to get this requirement done (Or) any sample code would be really helpful/ appriciated.
Thanks,
Dev.
My requirement is to redirect my page to a visualforce page when i select a particular record type. and it should autopopulate some fields from its parent object.
Example: My visualforce page is on Contact object and after i choose a record type it should redirect to a new visualforce page with address fields on contact object auto populated from Account object.
I have tried working on this with the help of some Blog's.. But it didn't worked the way i want.
So can anyone suggest the exact way to get this requirement done (Or) any sample code would be really helpful/ appriciated.
Thanks,
Dev.
In the extensions class create a method Redirect containing the logic
Please check below post for same issue
1) http://salesforce.stackexchange.com/questions/121142/redirect-to-visualforce-page-after-record-type-chosen
Let us know if this will help you
Many thanks for your response.
Tried using above code and i have overridden the standard new button, but it is redirecting to same visualforce page for all record types, even i have specified the record typeId in my controller.
My requirement is to redirect it to visualforce page for 1 record type && for others it should stick with standard layout.
Below is the code, Please update if anything wrong.
VF PAGE:
<apex:page standardcontroller="Contact" extensions="Redirect" action="{!getredir}">>
</apex:page>
CONTROLLER:
public class Redirect {
public Redirect(ApexPages.StandardController controller) {
//this.c = (Contact)myController.getRecord();
}
public PageReference getRedir() {
PageReference newPage;
if (ApexPages.currentPage().getParameters().get('RecordType') == '012280000015D4W') {
newPage = Page.Contact_New;
return newPage.setRedirect(true);
} else {
return null;
}
}
private final ApexPages.StandardController controller;
}
Thanks,
Dev.