2

Can someone please help me here?I have the piece of code here alongwith the error I am facing. Apex class:Code snippet:

Map<Id,Attachment> mapCaseAttachments = new Map<Id,attachment>();
for (List<Call2_vod__c> c : listOfLists) {
    attachment atf = mapCaseAttachments.get(c.Account_vod__C);
    attachmentCaseWrapper cw = new attachmentCaseWrapper(c,atf);
    caseWrapper.add(cw);
}

Error:

Compile Error: Initial term of field expression must be a concrete SObject: LIST

2
  • Can you please update your question and post your attachmentCaseWrapper? Sep 11, 2014 at 7:49
  • 1
    BTW if you're using the listOfLists example I answered your question yesterday with, you could accept the answer.
    – Dominic
    Sep 11, 2014 at 7:55

1 Answer 1

8

You're cycling through a list of lists, not a list of SObjects.

for (List <Call_to_Vod__C> c : listOfLists) {    
  attachment atf = mapCaseAttachments.get(c.Account_vod__C);    
}

The error message is pretty clear actually:

Initial term of field expression must be a concrete SObject: LIST

  • You have a field expression c.Account_vod__C
  • The initial term of that expression is c
  • c is not an SObject, it is a LIST

If you want to get at the SObject:

for (List <Call_to_Vod__C>  cs : listOfLists) {   
  for (Call_to_Vod__C c : cs)    {
     /// bla bla c.Account_vod__C   
  } 
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .