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
s9s9 

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

Hi

 

LIST <contact> c=[select lastname,firstname,account.name,account.industry from contact where title='New Software'];
system.debug(c.account.name);
system.debug(c.account.industry);
system.debug('the lastname is '+c.lastname);

 

 

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

 

 

Thanks Ramesh

hitesh90hitesh90

Hi,

 

You have to use For loop here for list.

Try to use following code.

 

LIST <contact> c=[select lastname,firstname,account.name,account.industry from contact where title='New Software'];
for(Contact c: contact){
	system.debug(c.account.name);
	system.debug(c.account.industry);
	system.debug('the lastname is '+c.lastname);
}

 

Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
My Blog:- http://mrjavascript.blogspot.in/

Satish_SFDCSatish_SFDC
That is a list which is being retrieved.
so you will have to loop through the list and get individual contact records.

for(Contact con : c){
System.debug(con.account.name);
------
----------
}

Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.
Satish_SFDCSatish_SFDC
Oh same time reply.....
@anilbathula@@anilbathula@
HI s9,

system.debug(c.account.name);
C is a list type so ,if put c.account.name system cannot recognize which one to display.
So it is raising this error .just change the system .debug to this:-
system.debug(c[0].account.name);
system.debug(c[0].account.industry);
system.debug('the lastname is '+c[0].lastname);
This display the first element of the list.
s9s9

Thanks Anil

 

 

List<job_Application__c> j=[select id,name,Candidate__r.name,
                            candidate__r.phone__c,
                            Position__r.Functional_Area__c
                            from job_application__c
                            where name='JA-0011'];
system.debug(j[0]);

 

In the above code it's not display all fileds, it's display only id,name,candidate__r.name,the remaing fileds not display but it shows individual system log like system.debug
(j[0].candidate__r.phone);

 

 

Thanks

 

Satish_SFDCSatish_SFDC
There probably is a limit to the number of characters in a System.debug statement.
Are you using developer console. You can double click on the system.debug line which opens up a pop up to display more information.

Regards,
Satish Kumar
Anil KamisettyAnil Kamisetty
It is a simple Problem. You are retrieving the results into a List Variable. When you want to Access the Result set, you need to reference them by index.

LIST <contact> c=[select lastname,firstname,account.name,account.industry from contact where title='New Software'];
system.debug(c[0].account.name);
system.debug(c[0].account.industry);
system.debug('the lastname is '+c[0].lastname);

Once you add the Index, it should be fine. Hopefully there are some records returned from the SOQL, else you will get Null pointer exception.

Please mark the response if you think this addresses the issue. Others will get benefited from this.
Charles McDowellCharles McDowell
I clicked thumbs by mistake. I am new to Apex and you answer was spot on Thanks