-4

Running below code in anonymous window

 Id batchJobId = Database.executeBatch(new s360_batchDocumentEmailWeekly(),10);

but its throwing above error.

  global class s360_batchDocumentEmailWeekly {
  global String query = '';
  global Database.QueryLocator start(Database.BatchableContext bc) {
      query = 'select Id,Platform__c,Send_Revision_Email__c from Document__c 
      where Send_Revision_Email__c = true ';
      system.debug('>>>>' + query);
      return Database.getQueryLocator(query);
  }
  global void execute(Database.BatchableContext bc, List <Document__c> scope) {}
  global void finish(Database.BatchableContext bc) {

  } }
5

There are few things wrong.

  1. For a batch, you have to implement Database.Batchable interface.

    global class s360_batchDocumentEmailWeekly implements 
    Database.Batchable<sObject>{
      global String query = '';
      global Database.QueryLocator start(Database.BatchableContext bc) {
          query = 'select Id,Platform__c,Send_Revision_Email__c from Document__c 
          where Send_Revision_Email__c = true ';
          system.debug('>>>>' + query);
          return Database.getQueryLocator(query);
      }
      global void execute(Database.BatchableContext bc, List <Document__c> scope) {
    
      }
      global void finish(Database.BatchableContext bc) {
    
      } 
    }
    
1
  • 2
    ufff.. I dont how I missed this one. Error itself says about this interface but i dint catch it...Thanks Apr 26 '18 at 8:38

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.