+ Start a Discussion
XXXXXX 

How to add VF "page" as an element within a standard layout

Here's what we need to do: We need to add some special logic to a standard layout. We want to replace a standard layout field with a VF "page" that will encapsulate the special logic. (The user shouldn't be aware that anything is different.) I understand how to create the VF page but I cannot figure out how to style the label and field to look like the standard layout. If I do the standard thing:

 

<apex:pageBlock ...> <apex:form ...> <apex:pageSection ...> <apex:pageSectionItem ...> <apex:outputLabel ...> <apex:inputField ...>

 

 

 

I get a nicely formatted label and field, but the whole thing is wrapped up in the page block styling. I just want the label and field, but it should look exactly the same as the rest of the layout. How can I do this?

 

Secondary question: If I do this, and there is a form embedded inside the standard layout, will the page be saved correctly?

 

TIA,

 

John

Best Answer chosen by Admin (Salesforce Developers) 
JimRaeJimRae

If I understand your question correctly, you are going to have an issue.

Currently, you can only have the VF page inserted on the page layout in view mode (not in edit mode).

So your question about the saving correctly would not be relevant.

 

 

All Answers

JimRaeJimRae

If I understand your question correctly, you are going to have an issue.

Currently, you can only have the VF page inserted on the page layout in view mode (not in edit mode).

So your question about the saving correctly would not be relevant.

 

 

This was selected as the best answer
sfdcfoxsfdcfox
Check the documentation for the apex: pageSection bit. It's given me problems in the past, and I expect it to do so in the foreseeable future, since it works only as precisely described in the documentation, and no other way. Make sure you specify the correct number of columns for the layout section, or the results might not be what you'd expect. Finally, you must recreate the entire page in Visualforce; you can't just drop it into a page layout and have it look correct, since Visualforce is designed to create entire pages if you use the standard elements, and particularly since page layouts won't display Visualforce components in an edit layout, only in a detail view. Also, it should be noted that even if you could, you wouldn't want to because that value would be lost when the user clicked the default "save" button, which wouldn't be aware of the value(s) inside the Visualforce page.
Message Edited by sfdcfox on 08-04-2009 01:29 PM
XXXXXX
That isn't good. Do I understand correctly that SF is going to deprecate S-Controls, which can do what I need, in favor of Visualforce, which can't do what I need? What kind of a product plan is that?
JimRaeJimRae

I agree it is not fully thought out.

 

I would recommend voting for this idea on the idea exchange:

 

http://ideas.salesforce.com/article/show/10097442/Add_a_Visualforce_PageComponent_inline_on_Edit_page