You need to sign in to do that
Don't have an account?
Matthew Stroud
Failed Custom Controllers Trailhead with Working Code
Here is my controller:
But when I verify the challenge I get:
"Challenge not yet complete... here's what's wrong:
Case records were not returned upon calling 'getNewCases'. Either the method does not exist, or it does not return the expected list of cases."
public class NewCaseListController { public static List<Case> getNewCases() { List<Case> results = [SELECT Id, CaseNumber FROM Case WHERE Status ='New']; return results; } }Here is my page:
<apex:page controller="NewCaseListController"> <apex:repeat value="{! newCases }" var="case"> <li><apex:outputLink value="/{!case.Id}">{!case.CaseNumber}</apex:outputLink></li> </apex:repeat> </apex:page>Here is the result:
But when I verify the challenge I get:
"Challenge not yet complete... here's what's wrong:
Case records were not returned upon calling 'getNewCases'. Either the method does not exist, or it does not return the expected list of cases."
Can you please try after removing static keyword from your getNewCases method? I think that is the problem.
Thanks
All Answers
Can you please try after removing static keyword from your getNewCases method? I think that is the problem.
Thanks
Static methods can be invoked with the classname without having to create the object of the class. But I seriously don't know how it mattered here. I found out the problem in your code by trial and error.