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
Ram Shiva KumarRam Shiva Kumar 

Problem with Extensions


I wrorte a simple extension with the VFpage , but when i try to save thr VF page iam getting the error like ,"Error: Unknown constructor 'extra.extra(ApexPages.StandardSetController controller)'Create Apex method 'extra.extra(ApexPages.StandardSetController controller)'"

Earlier i was not getting this kind of errors when iwaswriting the extensions.Please let me know which is causing the error,


<apex:page standardController="Account"  recordSetVar="ab" extensions="extra" >

<apex:pageBlock >
<apex:pageBlockTable value="{!ab}" var="c" >  
 <apex:column value="{!c.Name}"/>
 <apex:commandButton value="{clickme}" action="{!click}"/>

Extension code:
Public class extra

Public extra(ApexPages.StandardController stdController  )


Public void click()

System.debug('hiiiiiiiiiiiiiiiiiii good mng');




Vasani ParthVasani Parth

If you are not using recordSetVar then your Controller Extension constructor needs to take an ApexPages.StandardController argument rather than a ApexPages.StandardSetControllerargument.

See the documentation here  ( more information.

"A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller you want to extend."

You can then get the current record using the StandardController.getRecord() method which is documented here (

"Returns the record that is currently in context, based on the value of the id query string parameter in the Visualforce page URL."

Please mark this as the best anser if this helps

Ram Shiva KumarRam Shiva Kumar
Hi Vasani Parth,

Now my VF code is being saved , but when i run the VF code, aim getting the list correctlr , but in the extension class i have mentioned the Syatem.Debug('hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii') in the above codeyou can see  that. 

But when i checked the debug logs after  running the VF code, iam not seeing this  hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii .

Please suggest me.