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

vf with controller
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
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
VF Page
<apex:page controller="NewCaseListController">
<apex:repeat value="{!NewCases}" var="Case">
<apex:outputLink onclick="/?id={!Case.Id}">
{!Case.CaseNumber}
</apex:outputLink>
</apex:repeat>
</apex:page>
Controller:-
public with sharing class NewCaseListController {
public List<Case> getNewCases() {
List<Case> results = Database.query(
'SELECT Id, CaseNumber, Origin, Status, Account.Name ' +
'FROM Case ' +
'LIMIT 10'
);
return results;
}
}
<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>
<apex:page controller="NewCaseListController">
<apex:repeat var="case" value="{!NewCases}">
<li>
<apex:outputLink value="/{!case.id}">{!case.id}</apex:outputLink>
{!case.CaseNumber}
</li>
</apex:repeat>
</apex:page>
( Write the below code Inside the apex class)
public class NewCaseListController {
list<case> newcase = new list<case>();
public list<case> GetNewCases()
{
newcase = [Select Id,CaseNumber from case where status='New'];
return newcase;
}
}
Please find my codes
Vf Code
<apex:page controller="NewCaseListController">
<apex:form>
<apex:pageBlock title="Case List" id="cases_list">
<apex:repeat values="{!NewCases}" var="Case">
<apex:outputLink value="/{!Case.Id}">{!Case.CaseNumber}</apex:outputLink>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Code
public class NewCaseListController {
public List<Case> getNewCases(){
List<Case> results = Database.query(
'SELECT id, CaseNumber ' +
'FROM Case ' +
'WHERE Status=\'New\'');
return results;
}
}
Whenever I amexecuting the code , I am receiving this error
"Unsupported attribute values in <apex:repeat> in NewCaseList at line 6 column 56"
Can anyone put some light on it.
Thanks
Soumyadip
<apex:page Controller="NewCaseListController " >
<apex:repeat value="{!newCases}" var="case" id="theRepeat">
<li><apex:outputLink value="/{!case.id}">{!case.ID }</apex:outputLink></li>
<li><apex:outputLink value="/{!case.id}">{!case.CaseNumber }</apex:outputLink></li>
</apex:repeat>
</apex:page>
For The Apex Class-:
public class NewCaseListController
{
private String sortOrder = 'CaseNumber';
public List<Case> getNewCases() {
List<Case> results = Database.query(
'SELECT Id, CaseNumber, Account.name ' +
'FROM Case ' +
'ORDER BY ' + sortOrder + ' ASC '
);
return results;
}
}
Hello Trailblazers!
In that challenge there is a small bug. The challenge ask a case list filtered by New. However it accept the challenge without filter. So...
For the VF Page:
<apex:page controller="NewCaseListController">
<apex:form >
<apex:pageBlock title="Case List" id="case_list">
<!-- Case List goes here -->
<apex:repeat value="{! newCases }" var="case">
<li><apex:outputLink value="/{!case.id}">{!case.CaseNumber}</apex:outputLink></li>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
For the Apex class:
public class NewCaseListController {
public List<Case> getNewCases() {
List<Case> newCases = Database.query('SELECT Id, CaseNumber FROM Case');
return newCases;
}
}
I tried this and it works perfect.See if this can help you.
VISUALFORCE PAGE :-
NewCaseListController CLASS :-
Thanks,
Chhavi Singhal
Hi People,
I have seen the code used to solve this particular problem but I don't understand why this works.
Is {!NewCases} the call for the public method in NewCaseListController class, GetNewCases? Is Get a keyword in Apex?
Thanks in advance for your comments here.
Create a Visualforce page that uses a custom controller to display a list of cases with the status of New.
Apex class:
public class NewCaseListController {
public List<Case> getNewCases(){
List<Case> Cases =[SELECT Id,CaseNumber From Case Where status='New'];
return Cases;
}
}
Visual Page:
<apex:page controller="NewCaseListController">
<apex:repeat value="{!NewCases}" var="Case">
<apex:outputLink onclick="/?id={!Case.Id}">
{!Case.CaseNumber}
</apex:outputLink>
</apex:repeat>
</apex:page>
Error:
Challenge not yet complete in naveen98k@salesforce.com
The method 'getNewCases' isn't working as expected. Either the method doesn't exist or it doesn't return the expected list of cases.
Plz help me......
Vf :-
Apex :-
NewCaseListController:
NewCaseList (page)
@urya Pratap Singh 13 I'm still having same problem.
not sure whats going on. but when clicking view it shows all new cases. but challenge is still showing that above error message.
Any idea?
Thanks in advance...
I have recently tried this and it works perfect. Hope will help you.
VF Page :-
<apex:page controller="NewCaseListController">
<apex:form >
<apex:pageBlock title="New Case List">
<ul>
<apex:repeat value="{!NewCases}" var="case">
<li>
<apex:outputLink value="/{!case.Id}">{!case.CaseNumber}</apex:outputLink>
</li>
</apex:repeat>
</ul>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Class:
public class NewCaseListController {
public List<Case> getNewCases() {
List<Case> resultList = [Select Id,CaseNumber from case where status='New'];
return resultList;
}
}
If you find it as a solution, please mark it correct.
APEX Controller