You need to sign in to do that
Don't have an account?

How can we access List<sObject> type object value in for each loop .?
List<sObject> objs ;
objs = Database.query('select name from Account');
for(sObject sobj : objs){
system.debug(sobj['name']); // this gives error Expression must be a list type: SObject
}
objs = Database.query('select name from Account');
for(sObject sobj : objs){
system.debug(sobj['name']); // this gives error Expression must be a list type: SObject
}
Any reason you want to go for sobject instead of list<Account>?
Try this in your system debug.
system.debug(sobj.get('name'));
Then you can able to access each record.
Thanks
Anil.B