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
Jeff C.ax327Jeff C.ax327 

Winter '09: Visualforce Page placed in page layout causes nested header/sidebar in Edit mode

We have a custom object that maintains a one-to-one relationship with the Contact object for contacts of a certain RecordType.  For these special contacts, we want to display the related custom object record as another detail section right below the Contact detail section.  We do not want to override the Contact page for all contacts, just for this one record type.  Unfortunately, there is no way to override View/Edit/etc for a specific record type, but Winter '09 does give us the ability to embed a Visualforce page within a page section on a standard page layout.  So, I created a page layout for our special record type and got busy...
 
Unfortunately, there is no way to make the page section expand to accomodate the contents -- you can give 100% width, but you have to provide a static height in pixels...... but that's another story, and not my current problem.
 
The problem is that, while the embedded custom detail section displays okay in View mode, when you click the embedded Edit button, another copy of the Salesforce header and sidebar are displayed in the page section, so you now have nested headers and sidebars.  Ah, but you immediately think you can get around this by replacing the custom object's default Edit button with a custom one that turns off the header and sidebar... no dice.  In fact, in this case if you don't turn off the header and sidebar you end up with an additional nest resulting in a total of three headers and sidebars.
 
Then I tried overriding the custom object's Edit with a simple Visualforce page that turns off the header and sidebar... but the page comes up in View mode unless you populate the <apex: page action="{!edit}"> attribute.  What *this* does is put you in an endless loop of calling the VF page and placing it in Edit mode over and over.
 
Tried every combination I can think of.  Doesn't play nice.  Does anyone know how to embed a Visualforce page in a page layout section that allows Edit without the extra header and sidebar?
 
Or even better, is there in fact a way to override View/Edit for a certain record type?  Then I could totally customize my page without all this fixed-height-embedding crap. :-)
DevGarethmdDevGarethmd
Jeff
If it's just a one-to-one relationship why don't you just extend the contact object to add the fields that you are currently using in your custom object. Then use the page layout associated with your record type to add those new fields and maybe put them in their own page section. That way you can do it all through standard declarative customisation without have to use VisualForce.
Jeff C.ax327Jeff C.ax327

Thank you for the suggestion, and it is a good one, but we are trying to avoid adding tons of custom fields to the standard Contact object.  We use Contacts for many different things and have around 15 different record types.  Our goal is to extend contacts on a case-by-case basis using a one-to-one custom object.  For the most part, we try to only add custom fields to the Contact object that are common across all or most of our contact record types.

However, I am discovering that there are some unexpected effects to adding a second detail section to a page.  For example, in the Console, the Mini Page section on the bottom right no longer appears, even though both the Contact and the custom object have related objects configured.

Jeff C.ax327Jeff C.ax327
I thought I might be onto something when I stumbled across the new custom list features released in Winter '09.  If I could override the related list for this particular custom object, that would be PERFECT.  However, it doesn't seem to matter what I override, the related list maintains its default view. Arrrrg... Am I missing something? Is there no way to override a related list with a Visualforce page?
Force.com discussion forumForce.com discussion forum

can you tell me how to code to add a section with header and visible only in Edit mode