Activity › Forums › Salesforce® Discussions › Is it possible to create a reusable inline Salesforce Visualforce page?
Tagged: Custom Component, Inline Visualforce Page, Salesforce Apex, Salesforce Controller, Salesforce sObject, Standard Controller
-
Is it possible to create a reusable inline Salesforce Visualforce page?
Posted by Ravi on April 30, 2016 at 5:52 PMIs it possible to create a reusable inline Visualforce page?
Avnish Yadav replied 7 years, 7 months ago 3 Members · 2 Replies -
2 Replies
-
Hi Ravi,
You don’t have to create a separate apex controller for each VF page, but you do need 1 VF page per standard controller you need to “extend”.
What we generally do is that create 1 controller class that uses generic SObject methods to manipulate its data. That controller has a method, getCtl(), which returns itself. It generify the VF content into a custom component which takes the single controller class as an argument. Then I create multiple VF pages with just a one-liner to that component, for e.g
<apex:page showHeader=”false” sidebar=”false” standardController=”Account” extensions=”MyGenericController”> <c:MyCommonVfComponent ctl=”{!ctl}” /> </apex:page> - [adinserter block='9']
-
Hello,
You can implement a VF page and as long as it shares the standard controller of the object whose page layout your trying to add it too, it’s available to be added to that page in the standard page-layout controller.
Thanks.
Log In to reply.