Skip to main content

Need help with challenge. Keep getting error "The method 'getNewCases' isn't working as expected. Either the method doesn't exist or it doesn't return the expected list of cases"  NewCaseListController.apxc:  public class NewCaseListController{ public List<Case> getNewCases() {     List<Case> results = Database.query(         'SELECT Id, CaseNumber' +         'FROM Case'  +         'WHERE Status = "New"'     );     return results;    }}  NewCaseList.vfp:  <apex:page controller='NewCaseListController'>    <apex:pageBlock title='New Cases List' id='cases_list'>            <apex:repeat  value='{!newCases}' var='case' rendered='true' >                               <li>     <apex:outputLink value='/{!case.ID}'>{!case.CaseNumber}  </apex:outputLink>                     </li>          </apex:repeat>       </apex:pageBlock> </apex:page>   

7 个回答
  1. 2022年4月20日 13:16

    <apex:page controller="NewCaseListController">

    <apex:form >

    <apex:pageBlock title="New Case List" id="cases_list">

    <apex:repeat value="{!newCases}" var="case" id="case">

    <p><apex:outputLink value="/{!case.Id}">{!case.CaseNumber}</apex:outputLink></p>

    </apex:repeat>

    </apex:pageBlock>

    </apex:form>

    </apex:page>

    public class NewCaseListController {

    public List<Case> getNewCases() {

    List<Case> results = Database.query(

    'SELECT Id, CaseNumber, Status ' +

    'FROM Case ' +

    'WHERE Status = \'New\' '

    );

    return results;

    }

    }

0/9000