1

I have a Component inside of a Visualforce Page. I am not sure if this line of connection is causing a break but my issue is with my constructor. It is not taking in the params I am passing:

Page:

<apex:page standardStylesheets="false" standardController="Credit_Review__c" action="{!checkValidVersion}" extensions="CreditreViewScreenController,CreditReportRemoting,sendToWebService2,RecommendationPanelController" sidebar="false" showHeader="false">
    <c:CreditReviewScreenRelatedDealsTab creditReviewObj="{!creditReview}" table="{!TableValue}" associatedContactsObjMap="{!ConsumerCreditSummaryMap}" associatedContactsObj="{!associatedContactList}" CreditSummaryObj1="{!CreditSummaryObj1}"/>

Component:

<apex:component id="CreditReviewScreenRelatedDealsTab" controller="IDAnalyticsController" extensions="oliviaTestClass" allowDML="true">

Extension:

public class oliviaTestClass {

    public oliviaTestClass(ApexPages.StandardController controller){}
}

I have tried passing in a StandardSetContoller, extending oliviaTestClass with extends IDAnalyticsController, assigning variable controller a value.... but I continue to get error: Error:(1, 1) Unknown constructor 'oliviaTestClass.oliviaTestClass(IDAnalyticsController controller)' What am I missing with constructors and class extensions? I have followed the documentation below with no success.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_extension.htm

*note: I did not include IDAnalyticsController for it is over 1000 lines long

5
  • why are using custom controller extension? Apr 6, 2017 at 20:17
  • Have you tried a no-args constructor i.e. public oliviaTestClass() or no constructor?
    – Keith C
    Apr 6, 2017 at 20:18
  • Just use custom controller Apr 6, 2017 at 20:18
  • @SantanuBoral I wanted to separate the logic from the IDAnalyticsController. It is two different projects so I was hoping to keep it clean. I can add to the IDAnalyticsController if needed.
    – Olivia
    Apr 6, 2017 at 20:21
  • @KeithC I have tried to not pass in any args and I get the typical error message: Error:(1, 1) Unknown constructor 'oliviaTestClass.oliviaTestClass(IDAnalyticsController controller)'
    – Olivia
    Apr 6, 2017 at 20:22

1 Answer 1

2

Although the constructor argument is often an ApexPages.StandardController because an SObject type is specified in the controller argument, where you specify a specific class as the controller argument it is that class name that needs to be the argument to the extension class constructor:

public class oliviaTestClass {
    private IDAnalyticsController ac;
    public oliviaTestClass(IDAnalyticsController ac) {
        this.ac = ac;
    }
    ...
}
1
  • ahhh this makes so much sense. IDAnalyticsController is not a standardcontroller. Thank you!
    – Olivia
    Apr 6, 2017 at 20:49

You must log in to answer this question.

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