I created a controller extension for the Contact object. I don't know if it will work or not, because I can not test it. Salesforce is acting like my controller extension does not exist.

Error: Unknown method 'ContactStandardController.task()'

To figure out what was going on, I copypasted the controller and vf page and tried to used it for a separate custom object. The vf page saved normally and gave me no error.

What am I doing wrong?

Here's a snippet of the vf page:

<apex:page standardController="Contact" showHeader="false" sidebar="false" extensions="ContactExtensionController">

<!-- Define Tab panel .css styles -->
.activeTab {background-color: #081f3f; color:white; background-image:none}
.inactiveTab { background-color: lightgrey; color:black; background-image:none}

<a href="/003/o"> &#60;&#60; Back to List</a><br/><br/>

<!-- Create Tab panel -->   
<apex:tabPanel switchType="server" selectedTab="Contact" id="ContacttabPanel"
tabClass="activeTab" inactiveTabClass="inactiveTab" styleClass="openInPopup">
<apex:tab label="Contact Information" name="name" id="Contact">
<apex:form > 

<apex:pageBlock >        
<apex:pageBlockSection >          
<apex:outputText style="font-size:20px;text-align:left;color:{!IF(Contact.Sales_Status__c = 'Proposal'||Contact.Sales_Status__c='Listing'||Contact.Sales_Status__c='Escrow'||Contact.Sales_Status__c='Sales Comp', 'red', '#081f3f')};" value="{0} | {1}"> 
<apex:param value="{!Contact.Name}"/>
<apex:param value="{!Contact.Sales_Status__c}" />

<apex:pageBlockButtons >
<apex:commandButton action="{!Save}" value="Save"/>
<apex:commandButton action="{!task}" value="Log A Call"/>

Here's the controller extension:

public class ContactExtensionController{
    Contact Contact;

    public ContactExtensionController(ApexPages.StandardController controller)
        Contact = (Contact)controller.getRecord();

    public PageReference save()
        update Contact;
        return null;

    public PageReference task()
            String sServerName = ApexPages.currentPage().getHeaders().get('Host');
        sServerName = 'https://'+sServerName+'/';
        String taskURL='00T/e?who_id='+Contact.id+'&followup=1&tsk5=Call&retURL=%2F'+Contact.id;
        PageReference retPage = new PageReference(sServerName + taskURL); 
        return null;


I'm sure I will get lots of comments about how my method is bad and doesn't work. But I can't change it to something that does work until I can actually use my extension. So I would like to figure out why that is.

  • Can you try to change the method's name task() and then try to save.
    – raym0nd
    Mar 30, 2016 at 18:36
  • I just tried changing it to "logCall"...same result unfortunately
    – MRG
    Mar 30, 2016 at 18:40
  • Also tried signing out of salesforce and closing everything and resigning in
    – MRG
    Mar 30, 2016 at 18:41
  • 1
    Can you post the full code here? I think it's something that's not included that's at fault — I just saved your code (completing the tabs etc.) and didn't get an error using the exact same extension controller.
    – Matt Lacey
    Mar 30, 2016 at 22:24
  • 1
    I just saved the page you put in paste bin (replacing Sales_Status__c with Email) and didn't get the error when viewing the page, with or without a contact Id... this is getting to be quite intriguing. Don't suppose it's a dev org you can share access to?
    – Matt Lacey
    Mar 30, 2016 at 23:04

2 Answers 2


The entire controller extension was not passing to the vf page. Not sure why. I made an exact copy of the vf page and the controller and everything worked normally and the error went away.

So I guess this was just some weird fluke. Thanks guys for trying to help!


Declare contact as, private final Contact Contact; Can you try changing constructor as following, this.objHoliday = (Holiday__c)controller.getrecord();

  • I tried this as well
    – MRG
    Mar 30, 2016 at 18:48
  • By default classes are with sharing...
    – raym0nd
    Mar 30, 2016 at 18:48
  • I edited my answer, can you try that.
    – Anurag
    Mar 30, 2016 at 19:01
  • I made the changes you suggested...am still getting the same error
    – MRG
    Mar 30, 2016 at 19:06

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.