You need to sign in to do that
Don't have an account?
SuAk
Trailhead:Create a Visualforce page displaying new cases
Hi,
Given below are the code for my custom controller :
public class NewCaseListController //{get;private set;}//
{
public List<case> getNewCases(){
List<case>results = Database.query(
'SELECT Id, CaseNumber, Status ' +
'FROM Case ' +
'WHERE Status = \'New\' '
);
return results;
}
}
Given below are the code for my visualforce page :
<apex:page controller="NewCaseListController">
<apex:pageBlock title="New Cases">
<apex:repeat var="case" value="{!cases}" id="new_cases"><br/>
<apex:outputLink value="/{!case.id}">{!case.name}</apex:outputLink>
</apex:repeat>
</apex:pageBlock>
</apex:page>
I am getting the folloing error :
Unknown property 'NewCaseListController.cases'
Kindly help.
Thanks,
Sujatha
Given below are the code for my custom controller :
public class NewCaseListController //{get;private set;}//
{
public List<case> getNewCases(){
List<case>results = Database.query(
'SELECT Id, CaseNumber, Status ' +
'FROM Case ' +
'WHERE Status = \'New\' '
);
return results;
}
}
Given below are the code for my visualforce page :
<apex:page controller="NewCaseListController">
<apex:pageBlock title="New Cases">
<apex:repeat var="case" value="{!cases}" id="new_cases"><br/>
<apex:outputLink value="/{!case.id}">{!case.name}</apex:outputLink>
</apex:repeat>
</apex:pageBlock>
</apex:page>
I am getting the folloing error :
Unknown property 'NewCaseListController.cases'
Kindly help.
Thanks,
Sujatha
If you want to use your code only then update your VF page like below:-
<apex:page controller="NewCaseListController">
<apex:pageBlock title="New Cases">
<apex:repeat var="case" value="{!NewCases}" id="new_cases"><br/>
<apex:outputLink value="/{!case.id}">{!case.name}</apex:outputLink>
</apex:repeat>
</apex:pageBlock>
</apex:page>
'Unknown property 'NewCaseListController.case'
No clue what is the issue.. Let me know if you have any solution.
Thanks,
Sujatha
VF 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>
Controller Class:-
public class NewCaseListController {
public List<Case> getNewCases()
{
List<Case> caseList = new List<Case>();
for(Case ct: [Select Id, CaseNumber FROM Case WHERE Status = 'New'])
caseList.add(ct);
return caseList;
}
}