0

I have created a extension class and when i try and deploy i get the error as described in the title. I have searched in the internet, but cannot see a resolution, therefore, if anyone has any ideas, that would be great.
Thank you all in advance

The Class

public with sharing class CheckPostalAddress {


public Boolean addressStatus {get; set;}

private ApexPages.StandardSetController stdController;


// Extension Constructor
public CheckPostalAddress(ApexPages.StandardSetController controller){
    this.stdController = controller;
}

// Standard Constructor
public CheckPostalAddress(){}



/** This is a dummy class to mimic an external call to a address verification web service @RemoteAction **/
@RemoteAction
public static Boolean CallAddressChecker(){

    // A dummy delay for the call to the web service
    // Plus not good practice in reality as could break the governer limits
    Integer start = System.Now().millisecond();
    while(System.Now().millisecond()< start+1000){

    }

    return true;
}
}

The Page

<apex:page id="CustomerSearch" Controller="ContactSearchController" sidebar="false" extensions="CheckPostalAddress">

<apex:form>

    <apex:pageMessages id="errors" />

    <apex:pageBlock title="Search Customer" mode="edit">

        <table width="100%" border="0">
            <tr>
                <td width="200" valign="top">

                    <apex:pageBlock title="Parameters" mode="edit" id="criteria">

                        <script type="text/javascript">
                            function doSearch() {
                                searchServer(
                                        document.getElementById("firstName").value,
                                        document.getElementById("lastName").value,
                                        document.getElementById("zipCode").value,
                                        document.getElementById("state").value,
                                        document.getElementById("ssn").value,
                                        document.getElementById("dob").value
                                );
                            }
                        </script>

                        <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors">
                            <apex:param name="firstName" value="" />
                            <apex:param name="lastName" value="" />
                            <apex:param name="zipCode" value="" />
                            <apex:param name="state" value="" />
                            <apex:param name="ssn" value=""/>
                            <apex:param name="dob" value=""/>
                        </apex:actionFunction>

                        <table cellpadding="2" cellspacing="2">
                            <tr>
                                <td style="font-weight:bold;">First Name<br/>
                                    <input type="text" id="firstName" onkeyup="doSearch();"/>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-weight:bold;">Last Name<br/>
                                    <input type="text" id="lastName" onkeyup="doSearch();"/>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-weight:bold;">Zip Code<br/>
                                    <input type="text" id="zipCode" onkeyup="doSearch();"/>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-weight:bold;">State<br/>
                                    <input type="text" id="state" onkeyup="doSearch();"/>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-weight:bold;">Social Security Number<br/>
                                    <input type="text" id="ssn" onkeyup="doSearch();"/>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-weight:bold;">Date of Birth<br/>
                                    <input type="text" id="dob" onkeyup="doSearch();"/>
                                </td>
                            </tr>
                        </table>

                    </apex:pageBlock>


                    <script type="text/javascript">
                        function ReverseDisplay(d) {
                            if(document.getElementById(d).style.display == "none") {
                                document.getElementById(d).style.display = "block";
                                document.getElementById('ShowHideLink').innerHTML = 'Hide Create Customer';
                            }
                            else {
                                document.getElementById(d).style.display = "none";
                                document.getElementById('ShowHideLink').innerHTML = 'Show Create Customer';

                            }
                        }
                    </script>

                    <a href="javascript:ReverseDisplay('uniquename')" id="ShowHideLink">Show Create Customer</a>

                    <div id="uniquename" style="display:none;">
                        <apex:pageBlock id="Create" title="Create Customer">

                            <script>

                                document.getElementById('CreateContactButton').style.display = "none";

                                function CheckAddress(){

                                    document.getElementById('CreateContactButton').style.display = "none";
                                    document.getElementById('CheckAddressStatus').innerHTML = 'Checking the entered address';

                                    var addressStatus;

                                    Visualforce.remoting.Manager.invokeAction(
                                            '{!$RemoteAction.CheckPostalAddress.CallAddressChecker}',
                                            function(result, event) {
                                                // Put the results into a var for pedantries sake
                                                addressStatus = result;

                                            });

                                    if (addressStatus){
                                        document.getElementById('CreateContactButton').style.display = "block";
                                        document.getElementById('CheckAddressStatus').innerHTML = 'Valid Address';
                                    }
                                    else{
                                        document.getElementById('CreateContactButton').style.display = "none";
                                        document.getElementById('CheckAddressStatus').innerHTML = 'Invalid Address, Try Again';
                                    }


                                }
                            </script>

                            <table cellpadding="2" cellspacing="2">
                                <tr>
                                    <td style="font-weight:bold;">Account<br/>
                                        <apex:selectList value="{!accounts}" multiselect="false" size="1" required="true">
                                            <apex:selectOptions value="{!items}"/>
                                        </apex:selectList>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">First Name<br/>
                                        <input type="text" id="newFirstName" required="required"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">Last Name<br/>
                                        <input type="text" id="newLastName" required="required"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">Address 1<br/>
                                        <input type="text" id="newAddress1" required="required"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">Address 2<br/>
                                        <input type="text" id="newAddress2" required="required"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">Address 3<br/>
                                        <input type="text" id="newAddress3" required="required"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">State<br/>
                                        <input type="text" id="newState" required="required"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">Zip Code<br/>
                                        <input type="text" id="newZipCode" required="required"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">Country<br/>
                                        <input type="text" id="newCountry" required="required" onblur="CheckAddress()"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">Social Security Number<br/>
                                        <input type="text" id="newSSN" required="required"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="font-weight:bold;">Date of Birth<br/>
                                        <input type="text" id="newDOB" required="required"/>
                                    </td>
                                </tr>
                            </table>

                            <div id="CheckAddressStatus"></div>

                            <div id="CreateContactButton">
                                <apex:commandButton value="Insert Customer" id="CreateCustomer" action="{!runSearch}" rerender="results,debug,errors">
                                    <apex:param name="firstName" assignTo="{!firstName}" value="newFirstName"/>
                                    <apex:param name="lastName" assignTo="{!lastName}" value="newLastName"/>
                                    <apex:param name="accountID" assignTo="{!accountID}" value="newAccount"/>
                                    <apex:param name="address1" assignTo="{!address1}" value="newAddress1"/>
                                    <apex:param name="address2" assignTo="{!address2}" value="newAddress2"/>
                                    <apex:param name="state" assignTo="{!state}" value="newState"/>
                                    <apex:param name="zipCode" assignTo="{!zipCode}" value="newZipCode"/>
                                    <apex:param name="countryName" assignTo="{!countryName}" value="newCountry"/>
                                    <apex:param name="ssn" assignTo="{!ssn}" value="newSSN"/>
                                    <apex:param name="dob" assignTo="{!dob}" value="newDOB"/>
                                </apex:commandButton>
                            </div>
                        </apex:pageBlock>
                    </div>

                </td>
                <td valign="top">

                    <apex:pageBlock mode="edit" id="results">

                        <apex:pageBlockTable value="{!contacts}" var="contact">

                            <apex:column >
                                <apex:facet name="header">
                                    <apex:commandLink value="First Name" action="{!toggleSort}" rerender="results,debug">
                                        <apex:param name="sortField" value="firstName" assignTo="{!sortField}"/>
                                    </apex:commandLink>
                                </apex:facet>
                                <apex:outputField value="{!contact.firstName}"/>
                            </apex:column>

                            <apex:column >
                                <apex:facet name="header">
                                    <apex:commandLink value="Last Name" action="{!toggleSort}" rerender="results,debug">
                                        <apex:param name="sortField" value="lastName" assignTo="{!sortField}"/>
                                    </apex:commandLink>
                                </apex:facet>
                                <apex:outputField value="{!contact.lastName}"/>
                            </apex:column>

                            <apex:column >
                                <apex:facet name="header">
                                    <apex:commandLink value="Zip Code" action="{!toggleSort}" rerender="results,debug">
                                        <apex:param name="sortField" value="zipCode" assignTo="{!sortField}"/>
                                    </apex:commandLink>
                                </apex:facet>
                                <apex:outputField value="{!contact.MailingPostalCode}"/>
                            </apex:column>

                            <apex:column >
                                <apex:facet name="header">
                                    <apex:commandLink value="State" action="{!toggleSort}" rerender="results,debug">
                                        <apex:param name="sortField" value="state" assignTo="{!sortField}"/>
                                    </apex:commandLink>
                                </apex:facet>
                                <apex:outputField value="{!contact.MailingState}"/>
                            </apex:column>

                            <apex:column >
                                <apex:facet name="header">
                                    <apex:commandLink value="SSN" action="{!toggleSort}" rerender="results,debug">
                                        <apex:param name="sortField" value="ssn" assignTo="{!sortField}"/>
                                    </apex:commandLink>
                                </apex:facet>
                                <apex:outputField value="{!contact.SSN__c}"/>
                            </apex:column>

                            <apex:column >
                                <apex:facet name="header">
                                    <apex:commandLink value="DOB" action="{!toggleSort}" rerender="results,debug">
                                        <apex:param name="sortField" value="dob" assignTo="{!sortField}"/>
                                    </apex:commandLink>
                                </apex:facet>
                                <apex:outputField value="{!contact.Birthdate}"/>
                            </apex:column>

                        </apex:pageBlockTable>

                    </apex:pageBlock>

                </td>
            </tr>
        </table>

        <apex:pageBlock title="Debug - SOQL" id="debug">
            <apex:outputText value="{!debugSoql}" />
        </apex:pageBlock>

    </apex:pageBlock>

</apex:form>
</apex:page>
4
  • I have a vague and possible false memory that when the controller extension is written for a custom controller it requires a matching constructor i.e. in your case public public CheckPostalAddress(ContactSearchController scs) {}. But looking at the error message I;m doubting that now..'
    – Keith C
    Oct 25 '16 at 18:24
  • @KeithC You're right, actually. I'm mobile, so you want the rep for this one?
    – sfdcfox
    Oct 25 '16 at 18:28
  • @KeithC - Good catch on the controller extending itself, although the error message posted does not seem to match the problem (not surprising). I would have expected to see <constructor>(ContactSearchController) or something similar....or I could just be reading it wrong.
    – Eric
    Oct 25 '16 at 19:16
  • @a-porter You mention that the compile error appears when you "try and deploy" the class. It that deployment between orgs, with something like a changeset. Or is that just deploying from an IDE to your development org? Oct 25 '16 at 20:19
1

This class:

public class AbcController {
}

and this class:

public class AbcExtension {
}

when used like this:

<apex:page controller="AbcController" extensions="AbcExtension">
</apex:page>

generate this page compilation error:

Error: Unknown constructor 'AbcExtension.AbcExtension(AbcController controller)'

which can be fixed by this change:

public class AbcExtension {
    public AbcExtension(AbcController c) {
    }
}

So a similar change is needed to the code in the question though the reported error is for a different problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.