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
Nick VerschuerenNick Verschueren 

Batch class must implement the method void database.batchable

Hi, I have following code, it's not much yet but I was trying to make a batch class. I just made the query and wanted to deploy to see if it works.
global class KBO_Batch implements Database.Batchable<sObject> {

    global Database.QueryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator([SELECT Id FROM KBO_data]);
    }

    global void execute(Database.BatchableContext bc, List<IttesIT_KBO_data> records){
        // process each batch of records
    }

    global void finish(Database.BatchableContext bc){
        // execute any post-processing operations
    }
}

But when I deploy I get following message:
force-app\main\default\classes\KBO_Batch.cls  Class IttesIT_KBO_Batch must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>) (1:14)

I double checked, copied new examples from the tutorials, but still it gives me this error...

Best Answer chosen by Nick Verschueren
AbhinavAbhinav (Salesforce Developers) 
Hi Nick,

Check whether this IttesIT_KBO_data name is correct or not as you are querying data KBO_data. 

Database.BatchableContext bc, List<KBO_data> records

or in general you can have Database.BatchableContext bc, List<Sobject> records. the error will go away.

If it helps mark it as best answer.

Thanks!

All Answers

AbhinavAbhinav (Salesforce Developers) 
Hi Nick,

Check whether this IttesIT_KBO_data name is correct or not as you are querying data KBO_data. 

Database.BatchableContext bc, List<KBO_data> records

or in general you can have Database.BatchableContext bc, List<Sobject> records. the error will go away.

If it helps mark it as best answer.

Thanks!
This was selected as the best answer
Nick VerschuerenNick Verschueren
Hi, 
that's my mistake, i was anomimizing some names but forgot one. The names were the same, but it pointed me to another mistake in the name of my object so it did solve my problem.
Thanks!