+ Start a Discussion
Madhav Raj 10Madhav Raj 10 

The method 'getNewCases' isn't working as expected. Either the method doesn't exist or it doesn't return the expected list of cases

<apex:page controller="NewCaseListController">
    <apex:pageBlock title="new Case List" id="cases_list">
        <li>
            <apex:repeat var="case" value="{!getNewCases}" rendered="true" >
                <p>
                    <apex:outputLink value="/{!case.ID}" >{!case.CaseNumber}
                    </apex:outputLink>
                </p>
            </apex:repeat>
        </li>
    </apex:pageBlock>
</apex:page>




public class NewCaseListController {
    public List<Case> getNewCases() {
    
        List<Case> results = [SELECT CaseNumber FROM Case WHERE status='New'];
            return results;
    }
}
SwethaSwetha (Salesforce Developers) 
HI Madhav,

You need to alter 
<apex:repeat var="case" value="{!getNewCases}" rendered="true" >

as
<apex:repeat var="case" value="{!NewCases}" rendered="true" >
in your VF page to fix the error.

You can also try below code VF page that uses pageBlockTable instead of <li> tag
<apex:page controller="NewCaseListController">
  <apex:pageBlock title="New Case List" id="case_list" >
      <apex:pageBlockTable value="{!NewCases}" var="ct">
          
         <apex:column headervalue="Case Link"><apex:outputLink value="/{!ct.id}">{!ct.id}</apex:outputLink>
       </apex:column>
          <apex:column value="{!ct.CaseNumber}">  
          
          </apex:column>
       
         
  <apex:repeat var="case" value="{!NewCases}">
    </apex:repeat>
          
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

If this information helps, please mark the answer as best. Thank you