1

I have VF Page which needs to be added to 2 different Object's Page Layout section. I am not able to refer the VF page unless VFP's StandardController attribute refers to the Object. Is there any way to refer my common VF Page into multiple object Page layouts? I dont want to create multiple VF Pages with Same code (Only diff would be the Standardcontroller).

One Design approach is have two VFP with different Standard contoller and include my page in both the VFP.

VF Page 1
<apex:page standardController="CustomObject1__c" extensions="Controller"> 
      <apex:include pageName="commonVFPage"/>
</apex:page>


VF Page 2
<apex:page standardController="CustomObject2__c" extensions="Controller"> 
      <apex:include pageName="commonVFPage"/>
</apex:page>

Is there any other good way to approach this problem?

1
  • AFAIK standardcontroller can support only one string at a time, so you cannot avoid 2 pages but as techbusinessman suggests component will be the way to go
    – Rao
    Dec 8, 2015 at 17:41

1 Answer 1

2

You will want to move your VF code to a VF Component Creating and Using Custom Components.

You can then create two VF pages which each include the same component (the standard controller is then on the VF Page and you can use a custom controller for your component).

This architecture will allow you to keep your code in one place but use on two standard pages.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .