Argument must be an object that implements Database.Batchable in Salesforce Batch Apex Class

Running below code to Developer Console and its throwing error,
ContactEmployeeNumberEmpty testCalc = new ContactEmployeeNumberEmpty();

Batch Apex Code:

global class ContactEmployeeNumberEmpty {

global Database.querylocator start(Database.BatchableContext BC) {
return Database.getQueryLocator([SELECT Id,
Name from Contact where Employee_Number__c = null]);

global void execute(Database.BatchableContext BC, list<Sales_Data__c> scope) {

global void finish(Database.BatchableContext BC) {

Argument must be an object that implements Database.Batchable

Technical Solution:
This is because you are implementing the schedulable rather than batchable interface. So You can’t invoke executebatch on the Shedulable Apex Code.

Add in your apex class code like below (implements Database.Batchable<sObject>)

global class ContactEmployeeNumberEmpty implements Database.Batchable<sObject>

Written by 

2x Salesforce MVP | Platform Champion | 18x Salesforce Certified | MuleSoft Certified | 8x Trailhead Ranger | TechForce Services | Sydney | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *