I am trying to write my first controller extension, and I am running into an error:
Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST at line 26 column 34
This is the code that generated the error:
public class CustFinAcctRelatedList{
private households__Household__c RG;
private List<households__HouseholdMember__c> RGMembs;
private List<Account> Accts;
private List<Financial_Account__c> finAccts;
//Get Household Record from VisualForce Page//
public CustFinAcctRelatedList(ApexPages.StandardController controller) {
this.RG = (households__Household__c)controller.getRecord();
}
public List<Financial_Account__c> getFinAccts()
{
//Get Household Members (junction object between Account and Household) from Household//
RGMembs = [
SELECT id, households__Household__c, households__Account__c
FROM households__HouseholdMember__c
WHERE households__HouseholdMember__c.households__Household__c = :RG.id
];
//Get Accounts from Household Members (junction object between Account and Household)//
Accts = [
SELECT id
FROM Account
//****THE FOLLOWING LINE IS CAUSING THE ERROR****//
WHERE Account.id IN :RGMembs.households__Account__c.id
];
//Get Financial Account from Accounts//
finAccts = [
SELECT id, name, Client__r.name, Current_Value__c, Account_Type__c
FROM Financial_Account__c
WHERE Financial_Account__c.Client__c IN :Accts.id
];
return finAccts;
}
}
Any idea why this error is being generated?
I am going to use the return data to create a custom related list on a Visualforce page.
Thanks!