Here is the criteria for the question:
• 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. Controller:
public class NewCaseListController {
public static 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;
}
}
VFP:
<apex:page controller = "NewCaseListController" >
<apex:repeat value ="{!newCases}" var="case">
</apex:repeat>
</apex:page>
For some reason my apex:page tags aren't showing up in the code above (I do have them)... the issue is I don't know what to do with the repeat tag (last bullet)
value="{! URLFOR($Action.Case.View, case.Id) }"
is the wrong answer, but should be the right answer as it actually takes you to the detail case when clicked.value="/apex/{!case.Id}"
is the right answer, but doesn't take you to the case detail when clicked. So perhaps they want you to hard code the url up to the id, which is ridiculous because that could change, and it's a temporary dev org, which makes the domain and url even more ridiculous to hardcode.return [Select Id, CaseNumber FROM Case WHERE status = 'New'];