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
MaggieSumitMaggieSumit 

My Code is there And i want to call employee name from custom controller but i am unable to get all the names.

    <apex:pageBlock title="List Of Employee With Details">
        <apex:pageBlockTable value="{!chs}" var="e" >
          <apex:column value="{!e.Employee_name__c}"/>    
    </apex:pageBlockTable>

my controller

public with sharing class ControllerforMulti {

    public EmployeeDetail__c chs{get; set;}
  
    public ControllerforMulti(){
        chs= new EmployeeDetail__c();
        docs = new Task_Management__c();
    }
    public PageReference saveObjects() {
        insert chs; 
        docs.Empo_Name__c = chs.Employee_name__c;
        insert docs;
        PageReference prs = new PageReference('/'+docs.id);
        return prs;
    }

}
 
Virendra ChouhanVirendra Chouhan
Hi,

FIrst thing your "EmployeeDetail__c " object instance is not a list.
Second thing you haven't query records then how they will display on the page.
SarisfdcSarisfdc
Try below code:

public with sharing class ControllerforMulti {

    public list<EmployeeDetail__c> chs{get; set;}
  
    public ControllerforMulti(){
        chs= [select id, Employee_name__c from EmployeeDetail__c];
        docs = new Task_Management__c();
    }

}
MaggieSumitMaggieSumit
Error: ControllerforMulti Compile Error: Initial term of field expression must be a concrete SObject: List<EmployeeDetail__c> at line 10 column 33
Virendra ChouhanVirendra Chouhan
hi Sumit,

Sorry for the late response can you please paste your code here after modification done.

I think you are comparing a list with a single object instance that;s why you are getting this error.