-1

I am getting error in below code.

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

Code:

global class ContactBatch implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.Batcablecontext bc){
        string Query= 'Select id, Name, Fax, Email, MobilePhone, Description, Account.Name, Account.Rating, Account.Phone, Account.Industry FROM Contact';
        return database.getQueryLocator(query);
    }
    global void execute(Database.Batcablecontext bc, list<Contact> scope){
        integer size= scope.size();
        for(integer i=0; i<size; i++){
            contact con= scope.get(i);
            if(con.Fax== null || con.Fax==''){
                con.Fax= con.Account.Fax;
            }
        }
        update scope;

    }
    global void finish(Database.Batcablecontext bc){

    }
}
5

You have a typo in the argument's type (class Database.Batcablecontext) in the start(), execute() and finish() methods. As currently written the class name is missing letter h in Batcablecontext.

Updating the incorrect occurrences to the correct one -- Database.BatchableContext in those methods will resolve the issue.

  • Nice catch. Odd error, though, I would have expected an "Unknown type" error instead. – sfdcfox Jun 5 at 14:41
  • @sfdcfox I sometimes have hard time to understand the exceptions and errors honestly :) – Jayant Das Jun 5 at 14:42
  • I noticed in the last major compiler upgrade (sometime last year I think?), the compiler errors became a lot more cryptic. e.g. leaving a semi-colon off at the end of a SOQL statement complains about unexpected token '[' toward the beginning of the line. Drives me nuts. – JCD Jun 5 at 17:02
  • Thankyou @JayantDas.. It's works fine for me now... – srashti jain Jun 6 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.