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
DIVYANSHU BHUSHANDIVYANSHU BHUSHAN 

Error while retrieving list fields

I am querying some fields from an object and saving this into a list. Now I want use one of the field in IF condition, but I am receiving error " Initial term of field expression must be a concrete SObject" at IF condition line.
Please help me with these guys. 
Thanks in advance. :)
Cid = ApexPages.CurrentPage().getparameters().get('id');
list<Client_Intake_Forms__c> conCount = new list<Client_Intake_Forms__c>();
     conCount=[select id,name,Completed__c from Client_Intake_Forms__c where Client__c =:Cid ];
    System.debug('conCount>>>>>>>>>>'+conCount);
	if(conCount.Completed__c == true ){
		ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'This client has a finished intake form. A new intake form cannot be started.'));
		
		System.debug('In error condition');
		
	}

 
kevin lamkevin lam
conCount is a list and therefore you're getting an error in referencing conCount.Completed__c. You either need to reference a particular element of conCount or do it in a loop.
Chandra Sekhar CH N VChandra Sekhar CH N V
do something like this:
 
for(Client_Intake_Forms__c x:conCount){
if(x.Completed__c==true){
//your logic
}
}