function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mba75mba75 

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

I am a new Apex user and i write this code :

 

trigger opp_line_item_update on Opportunity (after update) {

for (opportunitylineitem[ ] olis : [Select z_oli_update__c From opportunitylineitem oli  where opportunityid in : trigger.new ]){

if (olis.z_oli_update__c!='world')
olis.z_oli_update__c='world';

}
}

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST:SOBJECT:OpportunityLineItem at line 4 column 1

What is the ptroblem with my  SObject ?




MikeD13MikeD13
I think you need to just use "opportunitylineitem" instead of "opportunitylineitem[ ]" to start the for loop. The for loop ill automatically iterate through the results from your SOQL query (kind of like a FOREACH).

Mike