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
Mallik VemuguntaMallik Vemugunta 

Initial term of field expression must be a concrete SObject

I am  getting Initial term of field expression must be a concrete SObject: LIST<Merchandise__c>error
for  the following code, please help

List<Account> accts = [SELECT Id, Name from Account]; ==> This is the line
System.debug(accts.size);
for(Account a : accts) {
System.debug('First Account Id: ' + a.Id);
System.debug('First Account Name: ' + a.Name); 
}
@anilbathula@@anilbathula@
Hi Mallik Vemugunta,

The problem is with system debug in second line.
It is not with the query,just change the System.debug(accts.size); to 
this System.debug(accts.size()); thats it.

Thanks
Anil.B
Ravikant kediaRavikant kedia
I write your code in console in check it so problem in your is accts.size()).

Please use below code :
List<Account> accts = [SELECT Id, Name from Account]; ==> This is the line
System.debug(accts.size());
for(Account a : accts) {
System.debug('First Account Id: ' + a.Id);
System.debug('First Account Name: ' + a.Name);
}
Mallik VemuguntaMallik Vemugunta
Thanks, I chnaged, but  still  getting same error.
List<Account> accts = [SELECT Id, Name from Account];
System.debug(accts.size());
for(Account a : accts) {
System.debug('First Account Id: ' + a.Id);
System.debug('First Account Name: ' + a.Name);
}
Mallik VemuguntaMallik Vemugunta
Sorry got it thanks