+ Start a Discussion
claperclaper 

Account Team Member SOQL error

I'm wrriting a VF page that needs to display in a page block table the current members of the account team and a checkbox next to each member. currently I'm getting this error Message: "AccountTeamAssignment Compile Error: Loop variable must be an SObject or list of AccountTeamMember"

 

here is my code: 

public List<teamMemberWrapper> fetchTeamMember(){
        teamMember = new List<teamMemberWrapper>();
        for(List<AccountTeamMember>  aList : [select userId, user.Name, teamMemberRole from AccountTeamMember where Accountid =: thisAccount.id]){
            for(AccountTeamMember a : aList)
            teamMember.add(new teamMemberWrapper(false, a));
        }
        
        return teamMember;        
}

public class teamMemberWrapper{
        
        public boolean selected {get; set;}
        public AccountTeamMember member {get; set;}

        public teamMemberWrapper(boolean selected, AccountTeamMember atm){
            this.selected = selected;
            this.member = atm;
        }
}    

 I've also tried to set the SOQL for like this: 

for(LAccountTeamMember  a : [select userId, user.Name, teamMemberRole from AccountTeamMember where Accountid =: thisAccount.id]){
            teamMember.add(new teamMemberWrapper(false, a));
}

 But no luck, any ideas?

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
claperclaper
Solved. I had created a class called "AccountTeamMember" , which was causing the issue, I changed the named of my apex class from "AccountTeamMember" to "AccountTeamMember_Extension"