1

Given the following code:

global class MyBatch implements Database.Batchable<SObject> { global MyBatch() {} global void execute(Database.BatchableContext BC, List<MyBatch Field__c> batch) { } global void finish(Database.BatchableContext BC) {} } 

What does this error Message mean?

MyBatch: Class must implement the global interface method: Iterable<SObject> start(Database.BatchableContext) from Database.Batchable<SObject>

1 Answer 1

3

It means that you're missing a particular method; the interface is trying to enforce the implementation of this class.

So adding this method to the MyBatch class will resolve the issue:

 global Database.Querylocator start (Database.BatchableContext BC) { return Database.getQueryLocator(query); } 
4
  • 2
    n.b. Unless you are doing managed packages, you can use public rather than global as access modifier throughout your batch class Commented May 20, 2015 at 22:25
  • @crop1645 That's good to know. Thank you! Commented May 21, 2015 at 2:49
  • 1
    yep - I learned it from @sfdcfox who knows everything Commented May 22, 2015 at 9:17
  • You can write a batch in a managed package that uses public rather than global too. Global is only needed to expose the class or method to code outside the package. Commented Mar 8, 2019 at 0:27

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.