Ive been working on this class to update a field on a related record with a field (zone) on the account record. When I try to test using "Id batchJobId = Database.executeBatch(new UpdateMarketPlaceFieldBatchV2(),200);" I get an error message "Line: 1, Column: 39 Constructor not defined: [UpdatezoeFieldBatchV2].()" What am I missing that is causing the error?
global class UpdatezoneFieldBatchV2 implements Database.Batchable<SObject>{
global String qry;
global integer recordsProcessed = 0;
global UpdatezoneFieldBatchV2(String q, String e){
qry=q;
}
global Database.qryLocator start(Database.BatchableContext BC){
qry = 'Select Id, zone__c From Vehicle__c where Account__c != null';
return Database.getqryLocator(qry);
}
global void execute(Database.BatchableContext BC, List<Vehicle__c> scope){
List<Vehicle__c> veh = [Select Id, zone__c From Vehicle__c where Account__c != null];
Map<Id, Account> accts = new Map<id, Account>([SELECT zone__c FROM Account WHERE Id IN (SELECT Account__c FROM Vehicle__c WHERE Id = :scope)]);
for(Vehicle__c e : veh){
Account a = accts.get(e.Account__c);
e.zone__c = a.zone__c;
recordsProcessed = recordsProcessed + 1;
}
update veh;
}
global void finish(Database.BatchableContext BC) {
System.debug(recordsProcessed + ' records processed');
}
}