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
bohemianguy100bohemianguy100 

unknown contructor

I have a visualforce page that I wamt to hook to a custom button on the Contact page layout.  When a user clicks on the button it will open the visualforce and display a list of records from a custom object that is related to a specific contact.

 

I setup the page using the standardController="Contact" and the extensions attribute...i.e. extensions="MyControllerExtension"

 

MyControllerExtension uses the StandardSetController so I can use pagination to page over the results, but I'm getting the error: Unknown constructor 'MyControllerExtension.MyControllerExtension(ApexPages.StandardController controller).

 

If I use the custom controller...i.e. controller="MyControllerExtension" then the visualforce page is not accessible to select as an option for the custom button.  How can I use the standardSetController in the my controller and still use the standardController from my VF page so I can hook the custom button to my page?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
VaderVader

Try the following in your class file:

 

private ApexPages.StandardController controller;	
	
	//*************************************************************
	//Constructor
	//*************************************************************
	public myCustomController(ApexPages.StandardController stdController) {
      
      controller = stdController;
 }

 

All Answers

VaderVader

Try the following in your class file:

 

private ApexPages.StandardController controller;	
	
	//*************************************************************
	//Constructor
	//*************************************************************
	public myCustomController(ApexPages.StandardController stdController) {
      
      controller = stdController;
 }

 

This was selected as the best answer
souvik9086souvik9086

Write like this

 

public class ExtensionController{

public ExtensionController(ApexPages.StandardController stdController) {

}

}

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks