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
SFDC BeginerSFDC Beginer 

Class Sample_Contactupdate_Batch must implement the method: System.Iterable<Contact> Database.Batchable<Contact>.start(Database.BatchableContext)

I have implemented the start method but still am getting above error.
below is my code. could anyone explain me.
global class Sample_Contactupdate_Batch implements Database.batchable<Contact> {
    
    global database.QueryLocator start(Database.BatchableContext jobid)
    {
        String query='select id,name,DOB__c from Contact where createdDate<=180' ;
          return  database.getQueryLocator(query);
        // we can query upto 50 million records
    }
    global void execute(Database.BatchableContext jobid,list<Contact> scope)
    {
        List<Contact> ctc=new List<Contact>();
        //Contact c=new Contact();
        for(Contact c:scope)
        {
            c.DOB__c=system.today+200;
           ctc.add(c);
        }
        update ctc;
    }
    global void finish(database.BatchableContext jobid)
    {
        
    }

}
Steven NsubugaSteven Nsubuga
global class Sample_Contactupdate_Batch implements Database.batchable<SObject> {
    
    global database.QueryLocator start(Database.BatchableContext jobid)
    {
        String query='select id,name, DOB__c from Contact where createdDate<=180' ;
          return  database.getQueryLocator(query);
        // we can query upto 50 million records
    }
    global void execute(Database.BatchableContext jobid,list<Contact> scope)
    {
        List<Contact> ctc=new List<Contact>();
        //Contact c=new Contact();
        for(Contact c:scope)
        {
           c.DOB__c = system.date.today()+200;
           ctc.add(c);
        }
        update ctc;
    }
    global void finish(database.BatchableContext jobid)
    {
        
    }

}
Raj VakatiRaj Vakati
Use this code
 
global class Sample_Contactupdate_Batch implements Database.batchable<Sobject> {
    
    global database.QueryLocator start(Database.BatchableContext jobid)
    {
		Date dt = System.today()-180 ; 
        String query='select id,name,DOB__c from Contact where createdDate<=:dt' ;
          return  database.getQueryLocator(query);
        // we can query upto 50 million records
    }
    global void execute(Database.BatchableContext jobid,list<Sobject> scope)
    {
        List<Contact> ctc=new List<Contact>();
        //Contact c=new Contact();
        for(Contact c:(Contact)scope)
        {
            c.DOB__c=system.today+200;
           ctc.add(c);
        }
        update ctc;
    }
    global void finish(database.BatchableContext jobid)
    {
        
    }

}

 
Madhu 3027Madhu 3027
global class BatchPSE implements Database.Batchable<API_Wrapper>, Database.Stateful {
  global string  jsonString=API_Test_PSE.Str;
 

  global Object[] start(Database.BatchableContext BC) {
      List<API_Wrapper> amcleads = (List<API_Wrapper>) JSON.deserialize(jsonString, List<API_Wrapper>.class);
      return amcleads;
   // return (API_Wrapper[])JSON.deserialize(jsonString, List<API_Wrapper>.class);
  }
  global void execute(Database.BatchableContext context, List<API_Wrapper> scope) {  //API_Wrapper[]
    // Do stuff here
  }
  global void finish(Database.BatchableContext context) {
  }
}
==========================================================
Class BatchPSE must implement the method: System.Iterable<API_Wrapper> Database.Batchable<API_Wrapper>.start(Database.BatchableContext)================>>>>please help me,why im getting this error....
Baird StraughanBaird Straughan
Whenever I run into this error, it's because I haven't closed my braces correctly.  Usually, one of the three methods (start, execute, finish) is incorrectly enclosed within another.