I have a visualforce page with 2 constructors

public customExtension(ApexPages.StandardSetController stdSetController) {

public customExtension(ApexPages.StandardController stdController){

The page is defined a

apex:page showHeader="true" sidebar="true" standardController="Job_Application__c"
tabStyle="Job_Application__c" extensions="customExtension" recordSetVar="varRecords">

I'm trying to make the page accessible from both a detail button to put on the objects standard layout and a list view button so it's accessible from a related list of objects on the parent record. If I remove the recordSetVar from the page definition I can define a detail button but not a list view and of course vise versa. Is there a way to make this work without having to define two different pages?

1 Answer 1


You need separate Visualforce Pages, because the only difference is recordSetVar. You can put the entire body into a Visualforce Component in the spirit of DRY. I omitted irrelevant attributes for brevity.


<apex:page standardController="Job_Application__c" extensions="MyExtension"

    <c:jobApplicationWidget someParam="{!someProperty}" />



<apex:page standardController="Job_Application__c" extensions="MyExtension">

    <c:jobApplicationWidget someParam="{!someProperty}" />


You must log in to answer this question.

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