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

I am trying to make a visualforce page with the following controller but I am writing it wrong somewhere
Hey Everyone, I am trying to make a visualforce page with the following controller but I am recieveing an error unknown property operation_class.cases on the VF page. Need help. Thank you in advance
---------------controler----------------
public class operations_class{
list<AccountWrapper> accountWrapperList = new list<AccountWrapper>();
public String currentRecordId {get;set;}
public operations_class(){
Map<Id, AccountWrapper> accountMap = new Map<Id, AccountWrapper>();
currentRecordId = ApexPages.CurrentPage().getparameters().get('id');
for(case acc :[SELECT CreatedById, Quote_Request__r.name FROM case WHERE id =: currentRecordId ]){
AccountWrapper accountWrap = accountMap.get(acc.CreatedByID);
if (null==accountWrap){
accountWrap = new AccountWrapper();
accountMap.put(acc.CreatedByID, accountWrap);
accountWrap.userId=acc.CreatedById;
}
accountWrap.cases.add(acc);
}
accountWrapperList = accountMap.values();
}
public list<AccountWrapper> getAccounts()
{
return accountWrapperList;
}
public class AccountWrapper
{
public Id userId {get; set;}
public List<case> cases {get; set;}
public AccountWrapper()
{
cases=new List<case>();
}
}
}
----------VFpage------------------------------
<apex:page controller="operations_class">
<table>
<apex:repeat value="{!cases}" var="cas">
<tr>
<td>
<apex:outputText value="Name : {!cas.Name}"/>
</td>
</tr>
</apex:repeat>
</table>
</apex:page>
---------------controler----------------
public class operations_class{
list<AccountWrapper> accountWrapperList = new list<AccountWrapper>();
public String currentRecordId {get;set;}
public operations_class(){
Map<Id, AccountWrapper> accountMap = new Map<Id, AccountWrapper>();
currentRecordId = ApexPages.CurrentPage().getparameters().get('id');
for(case acc :[SELECT CreatedById, Quote_Request__r.name FROM case WHERE id =: currentRecordId ]){
AccountWrapper accountWrap = accountMap.get(acc.CreatedByID);
if (null==accountWrap){
accountWrap = new AccountWrapper();
accountMap.put(acc.CreatedByID, accountWrap);
accountWrap.userId=acc.CreatedById;
}
accountWrap.cases.add(acc);
}
accountWrapperList = accountMap.values();
}
public list<AccountWrapper> getAccounts()
{
return accountWrapperList;
}
public class AccountWrapper
{
public Id userId {get; set;}
public List<case> cases {get; set;}
public AccountWrapper()
{
cases=new List<case>();
}
}
}
----------VFpage------------------------------
<apex:page controller="operations_class">
<table>
<apex:repeat value="{!cases}" var="cas">
<tr>
<td>
<apex:outputText value="Name : {!cas.Name}"/>
</td>
</tr>
</apex:repeat>
</table>
</apex:page>
Can you confirm what exactly you are trying to achieve using this vf page so can check and let you know the issue here.
Thanks,
--------------------------class--------------
public class operations_class{
public List<Case> getNewCases(){
List<Case> filterList = [SELECT AccountId,CreatedById,Quote_Request__r.name FROM case WHERE Id ='50005000005ym2OAAQ' ];
return filterList;
}
}
-----------------------------VFpage-----------------------------
<apex:page controller="operations_class">
<apex:pageBlock>
<apex:pageBlockTable value="{!filterList}" var="a">
<apex:column value="{!a.Quote_Request__r.name}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>