+ Start a Discussion
TheresaAndersonTheresaAnderson 

Initial term of field expression must be a concrete SObject List

Can you help me with the following error msg?

 

Initial term of field expression must be a concrete SObject List

 

trigger ChatterPostSURLStatus on Contract (after update) {

  for(Contract c: Trigger.new){
    CollaborationGroup[] oG = [Select ID, Name from CollaborationGroup];
      if(c.Status == 'Granted' && c.ActivatedDate==Today() && oG.Name == 'Renewal'){
          FeedPost sPost = new FeedPost();
          sPost.ParentId = oG.ID;
          sPost.Body = c.Account && 'is now supported on SURL';
          insert sPost;
          }
    }
}

Best Answer chosen by Admin (Salesforce Developers) 
imranrazaimranraza

Hi TheresaAnderson,

CollaborationGroup[] oG = [Select ID, Name from CollaborationGroup];
      if(c.Status == 'Granted' && c.ActivatedDate==Today() && oG.Name == 'Renewal')

oG is an Array of SObjetcs and you are trying to get field of abject that is not possible directly to need to specify which element of the Array yoou wantto get fields like this:-

CollaborationGroup[] oG = [Select ID, Name from CollaborationGroup];

CollaborationGroup g = oG[0];

if(c.Status == 'Granted' && c.ActivatedDate==Today() && G.Name == 'Renewal')

 

This will work..

All Answers

imranrazaimranraza

Hi TheresaAnderson,

CollaborationGroup[] oG = [Select ID, Name from CollaborationGroup];
      if(c.Status == 'Granted' && c.ActivatedDate==Today() && oG.Name == 'Renewal')

oG is an Array of SObjetcs and you are trying to get field of abject that is not possible directly to need to specify which element of the Array yoou wantto get fields like this:-

CollaborationGroup[] oG = [Select ID, Name from CollaborationGroup];

CollaborationGroup g = oG[0];

if(c.Status == 'Granted' && c.ActivatedDate==Today() && G.Name == 'Renewal')

 

This will work..

This was selected as the best answer
TheresaAndersonTheresaAnderson

Thank you.

Suresh RaghuramSuresh Raghuram

Thank you this helped me too