You need to sign in to do that
Don't have an account?

Creating and Using Custom Controllers Trailhead Challenge Problem
Hello Community,
Need some help on this challenge " Creating and Using Custom Controllers"
Here is my criteria:
Create a Visualforce page that uses a custom controller to display a list of cases with the status of 'New'.The page must be named 'NewCaseList'.
The custom controller Apex class must be named 'NewCaseListController'.
The 'NewCaseListController' Apex class must have a publically scoped method named 'getNewCases'.
The 'getNewCases' Apex method should have the return type of 'List' and return a list of case records with the ID and CaseNumber fields and filtered to only have a status of 'New'.
The 'NewCaseList' Visualforce page must use an apex:repeat component which is bound to 'newCases'.
The apex:repeat component must refer to the var attribute as 'case'.
Within the apex:repeat component, bind a apex:outputLink component to the ID of the case so that the page directs the user to the detail page of the respective case record.
Here is my error received:
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.
Here are my codes: ( I've adjusted some code in respect to other threads on the subject to make you aware)
Controller Class Code

New Case List VFP Code

Please advise this has been a very interesting one from a code perspective and being a newbie of sorts quite challenging lol.
Need some help on this challenge " Creating and Using Custom Controllers"
Here is my criteria:
Create a Visualforce page that uses a custom controller to display a list of cases with the status of 'New'.The page must be named 'NewCaseList'.
The custom controller Apex class must be named 'NewCaseListController'.
The 'NewCaseListController' Apex class must have a publically scoped method named 'getNewCases'.
The 'getNewCases' Apex method should have the return type of 'List' and return a list of case records with the ID and CaseNumber fields and filtered to only have a status of 'New'.
The 'NewCaseList' Visualforce page must use an apex:repeat component which is bound to 'newCases'.
The apex:repeat component must refer to the var attribute as 'case'.
Within the apex:repeat component, bind a apex:outputLink component to the ID of the case so that the page directs the user to the detail page of the respective case record.
Here is my error received:
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.
Here are my codes: ( I've adjusted some code in respect to other threads on the subject to make you aware)
Controller Class Code
New Case List VFP Code
Please advise this has been a very interesting one from a code perspective and being a newbie of sorts quite challenging lol.
Here are the changes I made to my codes to make the challenge successful:
New Controller List VFP
New Case List Controller Class
All Answers
As error says update line 5 in your controller with getNewCases instead of New Cases
Thanks,
Himanshu
Here are the changes I made to my codes to make the challenge successful:
New Controller List VFP
New Case List Controller Class
VF Page
<apex:page controller="comments">
<apex:sectionHeader title="comments"/>
<apex:form >
<apex:commandButton value="New Comment" action="{!save}" />
<apex:commandButton value="Change Owner" action="{!save}" />
</apex:form>
<br/>
<apex:pageBlock title="comments" >
<apex:PageBlockTable value="{!comments}" var="comment__c">
<apex:column value="{!comment__c.Name}"/>
<apex:column value="{!comment__c.Comment__c}"/>
<apex:column value="{!comment__c.Total_Comment__c}"/>
</apex:PageBlockTable>
</apex:pageBlock>
</apex:page>
Controller:
public class comments {
List<Comment__c> comments;
public List<comment__c> getcomments() {
if(comments == null)
comments = [SELECT Total_Comment__c, Comment__c, Name, owner.name FROM comment__c ];
return comments;
}
public String getName() {
return 'Comments';
}
public PageReference save() {
return null;
}
}