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
MBarnardMBarnard 

Completely Confused - Unknown Property Error

Hey Guys,

So I'm trying to create a new Class and Component that will pull all cases that were closed this week and all cases that aren't yet closed.
I have a few purposes for this, one is to create an email around this that will go out every friday, but I also plan to possibly in the future place this actually within Salesforce as a page for quick visibility.

However, I am running in to an issue that I can't for the life of me figure out what i screwed up.

Yes, I am fairly certain this could be done differently with a query and then a map, but I'm still new to Apex and this makes sense, in my head.

The Error I am running in to is: "Save error: Unknown property 'Case=_List.ClosedCasesThisWeek'

Here is the Class: (yes there are more variables i plan on utilizing in the component but without fixing this error, the additional variables don't matter anyways)
global class Case_List {

//Get Cases Currently Open, In Progress, In Dev, Open and Closed this Week
	
	global list <Case> OpenedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='Open'];
	global list <Case> ClosedCasesThisWeek = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name, ClosedDate from Case where ClosedDate = THIS_WEEK];
	global list <Case> InDevCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='In Dev'];
	global list <Case> InProgressCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='In Progress'];
	global list <Case> CompletedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where Date_Time_Completed__c = THIS_WEEK];
	global list <Case> CompletedbutNotClosedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where Status ='Completed'];
	
	global integer CasesOpenCount = OpenedCases.size();
	global integer CasesCloseThisWeekCount = ClosedCasesThisWeek.size();
	global integer CasesInDevCount = InDevCases.size();
	global integer CasesInProgressCount = InProgressCases.size();
	global integer CasesCompletedCount = CompletedCases.size();
	global integer CasesCompletedbutNotClosedCount = CompletedbutNotClosedCases.size();

}
Here is the Component
<apex:component controller="Case_List" access="global">
	<apex:dataTable value="{!ClosedCasesThisWeek}" var="ClosedCases" id="ClosedCases" rowClasses="odd,even">

			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!ClosedCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!ClosedCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!ClosedCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">CloseDate</apex:facet>
				<apex:outputText value="{!ClosedCases.ClosedDate}" />
			</apex:column>
	</apex:dataTable>
<apex:outputText html-font-size="17" value="Currently Open Cases" />
	<apex:dataTable value="{!OpenedCases}" var="Open" id="OpenCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!Open.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!Open.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!Open.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!Open.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Opened Date</apex:facet>
				<apex:outputText value="{!Open.CreatedDate}" />
			</apex:column>
	</apex:dataTable>
	<br />
	<br />
	<apex:outputText html-font-size="17" value="Cases Currently In Dev" />
	<apex:dataTable value="{!InDevCases}" var="InDevCases" id="InDevCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!InDevCases.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!InDevCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!InDevCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!InDevCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Open Date</apex:facet>
				<apex:outputText value="{!InDevCases.CreatedDate}" />
			</apex:column>
	</apex:dataTable>
	<br />
	<br />
	<apex:outputText html-font-size="17" value="Currently In Progress Cases" />
		<apex:dataTable value="{!InProgressCases}" var="InProgressCases" id="InProgressCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!InProgressCases.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!InProgressCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!InProgressCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!InProgressCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Open Date</apex:facet>
				<apex:outputText value="{!InProgressCases.CreatedDate}" />
			</apex:column>
	</apex:dataTable>
	<br />
	<br />
	<apex:outputText html-font-size="17" value="Cases Completed but not yet Closed" />
		<apex:dataTable value="{!CompletedbutNotClosedCases}" var="CompletedbutNotClosedCases" id="CompletedbutNotClosedCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Open Date</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.CreatedDate}" />
			</apex:column>
	</apex:dataTable>	
</apex:component>

I am confused as it doesn't matter if I only try to query 'ClosedCasesThisWeek' nor does the order matter, etc etc etc... help?
Vinit_KumarVinit_Kumar
The issue here is dataTable is not binded with a method which returns collection of data displayed in the table..Try below code this should work :-

VF Component :-
========================
<apex:component controller="Case_List" access="global">
    <apex:dataTable value="{!Case_List}" var="ClosedCases" id="ClosedCases" rowClasses="odd,even">

            <apex:column >
                <apex:facet name="header">Subject</apex:facet>
                <apex:outputText value="{!ClosedCases.Subject}" />
            </apex:column>
            </apex:dataTable>
</apex:component>


Apex Class :-
====================

public class Case_List {

    List<Case> ClosedCasesThisWeek;
    
    public List<Case> getCase_List()
    {
      
      ClosedCasesThisWeek = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name, ClosedDate from Case where ClosedDate =: System.today()];
      return ClosedCasesThisWeek;
    }
    
}

If this helps,please mark it as best answer to help others :)
MBarnardMBarnard
Even that one gives me an unknown property (i modified your componenet as {!Case_List} wasn't going to get what I needed :)

Is it possible to have multiple Select statements in one class?
    - I can't find this answer on google.
Vinit_KumarVinit_Kumar
Yes,you can hav multiple select statements,but each select Statements should return a List of case. 

Not sure how you are getting the error as this code works for me in my org.Can you post your latest so that I can take a look ??
MBarnardMBarnard
Got caught up working on other projects and returning to this today.

No matter what Variable i try to pull first, I end up with an unknown property of that variable.
   - In the example below it is Unkknown property 'List_Cases.OpenedCases'

My code is: 
global class List_Cases {

//Get Cases Currently Open, In Progress, In Dev, Open and Closed this Week
	public List<Case> OpenedCases;
	public List<Case> ClosedCasesThisWeek;
	public List<Case> InDevCases;
	public List<Case> InProgressCases;
	public List<Case> CompletedCases;
	public List<Case> CompletedbutNotClosedCases;

	public List<Case> get_OpenedCases()
	{
		OpenedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='Open'];
		return OpenedCases;
	}
	
	public List<Case> get_ClosedCasesThisWeek()
	{
    	ClosedCasesThisWeek = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name, ClosedDate from Case where ClosedDate = THIS_WEEK];
    	return ClosedCasesThisWeek;
	}
	
	public List<Case> get_InDevCases()
	{
    	InDevCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='In Dev'];
    	return InDevCases;
	}
	
	public List<Case> get_InProgressCases()
	{
    	InProgressCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='In Progress'];
    	return InProgressCases;
	}
	
	public list<Case> get_CompletedCases()
	{
    	CompletedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where Date_Time_Completed__c = THIS_WEEK];
    	return CompletedCases;
	}
	
	public list<Case> get_CompletedbutNotClosedCases()
	{
    	CompletedbutNotClosedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where Status ='Completed'];
    	return CompletedbutNotClosedCases;
	}
    global integer CasesOpenCount = OpenedCases.size();
    global integer CasesCloseThisWeekCount = ClosedCasesThisWeek.size();
    global integer CasesInDevCount = InDevCases.size();
    global integer CasesInProgressCount = InProgressCases.size();
    global integer CasesCompletedCount = CompletedCases.size();
	global integer CasesCompletedbutNotClosedCount = CompletedbutNotClosedCases.size();

 
}
<apex:component controller="List_Cases" access="global">
<apex:outputText html-font-size="17" value="Currently Open Cases" />
    <apex:dataTable value="{!OpenedCases}" var="Open" id="OpenCases" rowClasses="odd,even">
            <apex:column >
                <apex:facet name="header">Creator</apex:facet>
                <apex:outputText value="{!Open.CreatedBy.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Subject</apex:facet>
                <apex:outputText value="{!Open.Subject}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Account</apex:facet>
                <apex:outputText value="{!Open.Account.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Case Owner</apex:facet>
                <apex:outputText value="{!Open.Owner.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Opened Date</apex:facet>
                <apex:outputText value="{!Open.CreatedDate}" />
            </apex:column>
    </apex:dataTable>
    <apex:dataTable value="{!ClosedCasesThisWeek}" var="ClosedCases" id="ClosedCases" rowClasses="odd,even">

            <apex:column >
                <apex:facet name="header">Subject</apex:facet>
                <apex:outputText value="{!ClosedCases.Subject}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Account</apex:facet>
                <apex:outputText value="{!ClosedCases.Account.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Case Owner</apex:facet>
                <apex:outputText value="{!ClosedCases.Owner.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">CloseDate</apex:facet>
                <apex:outputText value="{!ClosedCases.ClosedDate}" />
            </apex:column>
    </apex:dataTable>

    <br />
    <br />
    <apex:outputText html-font-size="17" value="Cases Currently In Dev" />
    <apex:dataTable value="{!InDevCases}" var="InDevCases" id="InDevCases" rowClasses="odd,even">
            <apex:column >
                <apex:facet name="header">Creator</apex:facet>
                <apex:outputText value="{!InDevCases.CreatedBy.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Subject</apex:facet>
                <apex:outputText value="{!InDevCases.Subject}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Account</apex:facet>
                <apex:outputText value="{!InDevCases.Account.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Case Owner</apex:facet>
                <apex:outputText value="{!InDevCases.Owner.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Open Date</apex:facet>
                <apex:outputText value="{!InDevCases.CreatedDate}" />
            </apex:column>
    </apex:dataTable>
    <br />
    <br />
    <apex:outputText html-font-size="17" value="Currently In Progress Cases" />
        <apex:dataTable value="{!InProgressCases}" var="InProgressCases" id="InProgressCases" rowClasses="odd,even">
            <apex:column >
                <apex:facet name="header">Creator</apex:facet>
                <apex:outputText value="{!InProgressCases.CreatedBy.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Subject</apex:facet>
                <apex:outputText value="{!InProgressCases.Subject}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Account</apex:facet>
                <apex:outputText value="{!InProgressCases.Account.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Case Owner</apex:facet>
                <apex:outputText value="{!InProgressCases.Owner.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Open Date</apex:facet>
                <apex:outputText value="{!InProgressCases.CreatedDate}" />
            </apex:column>
    </apex:dataTable>
    <br />
    <br />
    <apex:outputText html-font-size="17" value="Cases Completed but not yet Closed" />
        <apex:dataTable value="{!CompletedbutNotClosedCases}" var="CompletedbutNotClosedCases" id="CompletedbutNotClosedCases" rowClasses="odd,even">
            <apex:column >
                <apex:facet name="header">Creator</apex:facet>
                <apex:outputText value="{!CompletedbutNotClosedCases.CreatedBy.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Subject</apex:facet>
                <apex:outputText value="{!CompletedbutNotClosedCases.Subject}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Account</apex:facet>
                <apex:outputText value="{!CompletedbutNotClosedCases.Account.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Case Owner</apex:facet>
                <apex:outputText value="{!CompletedbutNotClosedCases.Owner.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Open Date</apex:facet>
                <apex:outputText value="{!CompletedbutNotClosedCases.CreatedDate}" />
            </apex:column>
    </apex:dataTable>
</apex:component>