I am trying to use the below wrapper class in VF page as this class should return me record from Child Account and Address objects. However, I am unable to get it right. Please find the class below.

Please note - the condition WHERE Child_Account__c ='0017E00000FZqdVQAT' is used only for debugging purpose and I am expecting the list to return multiple rows.

In VF I'm trying to use :

<apex:repeat value="{!WrapperList}"  var="xx" >

But VF is showing error Unknown property ....WrapperList.

public without sharing class AffiliationWrapperClass {
    public List < AffiliationWrapper > WrapperList {get;set;}
    List < Child_Account__c > cAcList = new List < Child_Account__c > ();
    Set < Id > pAcId = new Set < Id > ();
    public AffiliationWrapperClass() {
        for (Child_Account__c cAc: [SELECT Name, OK_Role__c, Parent_Account__c, Work_Status_AGN__c,
                Parent_Account_vod__r.Beds__c, Parent_Account_vod__r.Name,
                Child_Account__c, Copy_Address__c, Network_Primary__c
                FROM Child_Account__c
                WHERE Child_Account__c = '0017E00000FZqdVQAT'
            ]) // filter with child acc
        Map < Id, Address__c > addrMap = new Map < Id, Address__c > ([select Account__c, Name from Address__c
            WHERE Account__c IN: pAcId
        ]); // filter with child's parent acc
        for (Child_Account__c ca: cAcList) {
            WrapperList.add(New AffiliationWrapper(ca, addrMap.get(ca.Parent_Account__c)));
    Public Class AffiliationWrapper {
        Child_Account__c accObj;
        String fullAddress;
        Public AffiliationWrapper(Child_Account__c accRec, Address__c addr) {
            accObj = accRec;
            fullAddress = addr.Name;
  • 4
    can you add your vf page code as well. have you added AffiliationWrapperClass as controller or extension?
    – Himanshu
    Aug 1, 2016 at 12:29
  • No, I'm calling AffiliationWrapperClass from my VF page's controller class.
    – CRM Guy
    Aug 1, 2016 at 15:57

3 Answers 3


Your VF page reference needs to look like:

<apex:repeat value="{!someCtrlGetterOfTypeAffiliationWrapperClass.WrapperList}"  var="xx" >

That is, the page can only see as the top level expression in the {!...} getters in the controller (or any super classes of the controller). Those getters can in turn be of types that reference objects in other classes.


WrapperList instance variable should have a getter method, try to initialize list in getter method rather than in constructor.

public class WrapperController {

    // Wrapper inner class
    List<DisplayAccountContacts> accounts;

    * Getter method to set records
    * */
    public List<DisplayAccountContacts> getAccounts(){
        if(accounts == null){
            accounts = new List<DisplayAccountContacts>();
            for(Account acc : [Select Id, Name, (Select Id, FirstName from Contacts) from Account]){
                accounts.add(new DisplayAccountContacts(acc));
        return accounts;

    * Inner Wrapper class
    * */
    public class DisplayAccountContacts {
        private Account account;
        private DisplayAccountContacts(Account account){
            this.account = account;
        public String name{
            get {return account.Name;}
        public String contactName{
                if(account.contacts.size() > 0){
                    return account.contacts[0].FirstName;
                    return 'No Contacts';

VisualForce page

<apex:pageBlockTable value="{!accounts}" var="acc">
  • 1
    It already does have a getter... public List < AffiliationWrapper > WrapperList {get;set;}
    – Adrian Larson
    Aug 1, 2016 at 13:47

Child_Account__c accObj and String fullAddress inside the wrapper class- was Private. and that was causing the issue as variables was not accssibles outside in the page .Else the code is working fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .