function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sean BarczynskiSean Barczynski 

Error: Unknown Property

Hello,

I'm trying to create a VisualForce page listing all clients who are due for a meeting.  I have created a Controller class and VF page using Eclipse.  When I try to save the VF page to the server, I receive the following error:

Save error:  Unknown property 'DueForReview.getAccounts'

Here is my code

Controller
public class DueForReview 
{
	private final List<Account> accounts =[select Id,  
                                                  Name,
                                                  Review_Frequency__c, 
                                                  Last_Review_Meeting__c
                                           from   Account];
	List<Account> DueForReview;

    public DueForReview()
    {
        for(Integer i=0; i<=accounts.Size()-1; i++)
        {
        	if(accounts[i].Review_Frequency__c == 'Quarterly' && accounts[i].Last_Review_Meeting__c <= Date.newInstance(System.today().year(),System.today().month()-3,System.today().day()))
        	{
        		DueForReview.add(accounts[i]);
        	}
        	
        	if(accounts[i].Review_Frequency__c == 'Semi-Annually' && accounts[i].Last_Review_Meeting__c <= Date.newInstance(System.today().year(),System.today().month()-6,System.today().day()))
        	{
        		DueForReview.add(accounts[i]);
        	}
        	
        	if(accounts[i].Review_Frequency__c == 'Annually' && accounts[i].Last_Review_Meeting__c <= Date.newInstance(System.today().year()-1,System.today().month(),System.today().day()))
        	{
        		DueForReview.add(accounts[i]);
        	}
        }
    }
    
    public List<Account> getAccounts() 
    {
        return DueForReview;
    }
}

VF Page
<apex:page controller="DueForReview">
    <apex:pageBlock title="Clients Due For Review">
        <apex:pageBlockTable value="{!getAccounts}" var="account">
            <apex:column value="{!account.name}"/>
            <apex:column value="{!account.Review_Frequency__c}"/>
            <apex:column value="{!account.Last_Review_Meeting__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

Please help!
Best Answer chosen by Sean Barczynski
AshlekhAshlekh
Hi 

Just need a small change.
 
<apex:page controller="DueForReview">
    <apex:pageBlock title="Clients Due For Review">
        <apex:pageBlockTable value="{!Accounts}" var="account"> <!-- instead of getAccounts we need to user Accounts-->
            <apex:column value="{!account.name}"/>
            <apex:column value="{!account.Review_Frequency__c}"/>
            <apex:column value="{!account.Last_Review_Meeting__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

-Thanks
Ashlekh Gera

All Answers

AshlekhAshlekh
Hi 

Just need a small change.
 
<apex:page controller="DueForReview">
    <apex:pageBlock title="Clients Due For Review">
        <apex:pageBlockTable value="{!Accounts}" var="account"> <!-- instead of getAccounts we need to user Accounts-->
            <apex:column value="{!account.name}"/>
            <apex:column value="{!account.Review_Frequency__c}"/>
            <apex:column value="{!account.Last_Review_Meeting__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

-Thanks
Ashlekh Gera
This was selected as the best answer
Sean BarczynskiSean Barczynski
That worked to get it uploaded, but now it just returns a page with no results.  Can you see anything wrong with my logic that wouldn't return the list correctly?
Sean BarczynskiSean Barczynski
So since this is in my Sandbox, it was showing an empty list because none of the households met the criteria within the if statements.  However, I made one fit the criteria and received the below error:
 
Sandbox

Apex script unhandled exception by user/organization: 00537000000ahJS/00D550000005rDy Source organization: 00D37000000IDT9 (null) Visualforce Page: /apex/test

caused by: System.NullPointerException: Attempt to de-reference a null object

Class.DueForReview.<init>: line 16, column 1
Sean BarczynskiSean Barczynski
Got it!  Looks like I didn't initialize the list correctly.  It seems to be working now.  Thanks for your help!