Ask Search:
Tom FairweatherTom Fairweather 

How to add a VisualForce page with custom controller to a page layout

According to this page
to add a visualforce page to a page layout the controller of the visual force page must match the object you want to add it to the page layout of.
What I have seen in reality is like this: if you want to add a VisualForce page to a page layout e.g. of Contacts then the standardcontroller must be set to Contact. At this point the VisualForce page appears in the page layout editor and it can be dragged in. After that you can then change the VisualForce page to have a custom controller and it will continue to work, and will continue to appear in the page layout editor.

This is kind of strange behaviour. Does anyone know if it's possible to add custom controlled VisualForce pages to a page layout in a more orthodox way? Is this a bug? I basically want to be able to write one VisualForce page with custom controller and be able to add it to any page layout I like.
Brad HollatzBrad Hollatz
Unfortunately this is not a bug.  I too have had to write mulitiple VisualForce pages to attach them to different standard page layouts.  I have had luck creating internal websites and using an Iframe to display the page on different page layouts.