我正在尝试编写我的第一个控制器扩展,但遇到了一个错误:
错误:编译错误:字段表达式的初始项必须是具体的 SObject:第 26 行第 34 列的 LIST
这是产生错误的代码:
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;
}
}
知道为什么会产生这个错误吗?
我将使用返回数据在 Visualforce 页面上创建自定义相关列表。
谢谢!