Method does not exist or incorrect signature: void schedule(String, String, BatchDeleteRecordChargeBack) from the type System

scheduleschedulebatchscheduled-apex

Can anything help me with this error. when my instance doesn't show the following error

Method does not exist or incorrect signature: void schedule(String, String, BatchDeleteRecordChargeBack) from the type System

Class Batch

global class BatchDeleteRecordChargeBack implements Database.Batchable<sObject>,  Database.Stateful {
    
    global Database.QueryLocator start(Database.BatchableContext BC){
        
        RangeDateCaseChargeback__c  RA =[SELECT Id,  StartDate__c, EndDate__c, testeDate__c from RangeDateCaseChargeback__c];
        
        String EndDate = RA.EndDate__c;
        string query = 'SELECT  id,  RecordType_Name__c, CreatedDate  from case where RecordType_Name__c =\'CBK\' AND CreatedDate = '+ EndDate +' limit 1';
        
        return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext BC, List<SObject> caseList) {
        Database.delete(caseList, false);    
    }
    
    global void finish(Database.BatchableContext BC) {
        
    }
}

Schedule

global class ScheduleBatchableCDeleteChargeBack implements Schedulable {
    global void execute(SchedulableContext SC) {
        BatchDeleteRecordChargeBack batch01 = new BatchDeleteRecordChargeBack(); 
        String sch = '0 0 * * * ?';
        System.schedule('Schedule Job1', sch, batch01);
    }
}

Best Answer

If you want to run the batch every 30 minutes then follow the below steps.

  1. Open the Developer Console
  2. Go to Debug / Open Execute Anonymous Window
  3. Enter below code and execute it
ScheduleBatchableCDeleteChargeBack sb= new ScheduleBatchableCDeleteChargeBack();

String cronStr = '0 0,30 * * * *';

System.schedule('ScheduleBatchableCDeleteChargeBack Job', cronStr, sb);
Related Topic