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
sriram anilsriram anil 

Error: Compile Error: Expression of type Schema.SObjectTypeFieldSets has no member named Doctor_feild at line 17

I am using feild sets in this program but error occcure in this program and pls give suggestion

public class CreateMultiplePatients{
    ID DoctorID;
    public Doctor__c docObj{get;set;}
    
    public List<Patient__c> multiplePatients{get;set;}
    
    public CreateMultiplePatients(ApexPages.StandardController varName){
        multiplePatients = New List<Patient__c>();
        
        DoctorID = apexpages.currentpage().getparameters().get('id');
        
      //  docObj = [SELECT id,name,daysworking__c,Joining_Year__c,Salary__c,specialization__c FROM Doctor__c where id=:DoctorID];      
     
     
     
        String validateQuery = 'SELECT id';
        for(Schema.FieldSetMember fld :SObjectType.Doctor__c .FieldSets.Doctor_feild.getFields()) {
                 validateQuery += ', ' + fld.getFieldPath();
        }
        validateQuery += ' from Doctor__c WHERE id=:DoctorID';
        
        docObj = dataBase.Query(validateQuery);
     
     
        Patient__c newpatient = New Patient__c();
        multiplePatients.add(newpatient);
    
    }
    
    public void addRow(){
         Patient__c newpatient = New Patient__c();
         multiplePatients.add(newpatient);
    }
    
    public pageReference saveMultiplepatients(){
        for(integer i=0;i<multiplePatients.size();i++){
           multiplePatients[i].TreatmentDoctor__c = DoctorID;
          //ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Error Message.'));

        }
        insert multiplePatients;
        
        pageReference pagref = New pageReference('/'+DoctorID);
        return pagref;       
    }    
 public void RemoveRow(){
        integer i = multiplePatients.size();
        multiplePatients.remove(i-1);
    }


}
Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi Sriram,
There should be a field set named Doctor_feild in Doctor__c object. When the code was written the field set was there. But perhaps it is deleted now. Thats why your code gets error.
In case if the field set is still in the object please check the spelling of the field set and the code both. As you can clearly see in Doctor_feild the spelling of 'field' is wrong.
Thank :)