function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Redirect standard page to VF 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.


You will have to write a custom logic in custom VF page and based on identified record typeredirect or fill in Details in next page (be it a standard page or any custom VF page)
This should be possible as follows -

1. Create a VF page with standardcontroller as the required object
2. Within VF page controller write logic to indetify the RecordType paramleter in the URL
new page URL will have paramter as
View Page URL should have an ID which can be used to identify the recordTYPe
3. use SOQL to identify record type and match with recordType id fetched at #2
4. redirect to any page as required.
5. Override the NEW/VIEW button in Setup for that particular object
6. VF page Logic should take care of neccesary re-directions.

let me know in case you have any difficulties acheiving  this,

Hi GarryP, Thanks for posting this info

I am also wanting to achive this. I am new to this side of things and was wondring if you could point me in the right direction with this. I understand the concept of your points above but am not 100% sure on how to do this. Would it be possible to post an example of the code?

Any help would be gratefully appreciated 

Thanks in advance