I am trying to create a VF Page on the Case, where I should be able to get the Contact associated with the case. I created a Controller extension like below

public with sharing class CaseControllerExtension {
    public Id Case_Id {get;set;}
    public CaseControllerExtension(ApexPages.StandardController controller) {
        Case caseObject = (Case)controller.getRecord();
        Case_Id = caseObject.Id;

    public List<Contact> getAssoContact(String caseId){        
        List<Case> Cont = [SELECT ContactId from Case where Id =: Case_Id LIMIT 1];
        List <Contact> conList = new List<Contact>();
        for(Contact con: [SELECT Id, Email, FirstName, LastName, Account.name, MailingCity, MailingState,  MailingCountry,Phone    
                     FROM Contact WHERE Id =: Cont[0].ContactId
                       ORDER BY Id ASC
                       LIMIT 1]){
      return conList;

And then In the VF Page I am referring the getAssoContact Method so I can reteieve the Contact info like below

<apex:page standardController="Case" extensions="CaseControllerExtension" title="Web Forms" lightningStylesheets="true">

   <apex:tabPanel switchType="client" selectedTab="name1" id="theTabPanel">
        <apex:tab label="Model Generation Services" name="name3" id="tabThree">
            <apex:pageBlock >
             <apex:pageBlockTable value="{!AssoContact}" var="con">
                         <apex:column value="{!con.FirstName}"/>      
                         <apex:column value="{!con.LastName}"/>

Here I am getting the error Error: Unknown property 'CaseStandardController.AssoContact' when saving the VF Page component, can anyone please tell me what I am missing here

1 Answer 1


Getters in Visualforce controllers/extensions can't take any arguments (neither can action methods). There's just no provision for passing arguments to methods like when working with just Apex. The one exception to that that I can think of is if you're using Javascript remoting.

You're getting the required data from the Case_Id property in your extension, and aren't using the caseId argument anyway, so simply remove the argument from the method signature in your extension, and things should work.

You must log in to answer this question.

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