You need to sign in to do that
Don't have an account?

Compilation Error Constructor not defined: [DeleteDownloadHitCountBatch].<Constructor>(String)
Can any one help me out with this error .When i compile all the classes , the system throws an error as :
Compilation Errors found: DeleteDownloadHitOlderAYearSchedular: line 4, column 67: Constructor not defined: [DeleteDownloadHitCountBatch].<Constructor>(String)Schedular Class is :
global class DeleteDownloadHitOlderAYearSchedular Implements Schedulable { global void execute(SchedulableContext sc) { DeleteDownloadHitCountBatch deleteDownloadHitCountBatch = new DeleteDownloadHitCountBatch('SELECT Id,Name FROM Download_Hit_Count__c WHERE CreatedDate < LAST_n_DAYS:365'); Database.executeBatch(deleteDownloadHitCountBatch,100); } }Batch Class :
global class DeleteDownloadHitCountBatch implements Database.Batchable<sObject>,Schedulable { global String query; /* global DeleteDownloadHitCountBatch(String q) { query = q; }*/ global DeleteDownloadHitCountBatch() { query = 'SELECT Id,Name FROM Download_Hit_Count__c WHERE CreatedDate < LAST_n_DAYS:365'; } global Database.QueryLocator start(Database.BatchableContext BC){ return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC, List<sObject> scope){ delete scope; //Database.emptyRecycleBin(scope); } global void finish(Database.BatchableContext BC){ } //execute methode for scheduler global void execute(SchedulableContext sc) { DeleteDownloadHitCountBatch delDownloadHitCount = new DeleteDownloadHitCountBatch(); Database.executeBatch(delDownloadHitCount ,200); } }Any help very much appreciated.
in your batch class "DeleteDownloadHitCountBatch ", you have Zero argumnet constructor as below so when you will instantitae DeleteDownloadHitCountBatch class, you need to use this zero argumnet cosstructor but in your scheduled class you have used one argumnet construcor and parameter is a string(soql) as so this one argumnet constructor is not exist in your batch class, so you need to use only zero argumnent constructor for this as per below code. Anyways same soql you have already placed in your batch class constructor so no need to pass it again during instantiation of the batch class.
please let me know if you need further help.
Thanks,
Debasis
All Answers
Please do let me know if it helps you.
Regards,
Mahesh
in your batch class "DeleteDownloadHitCountBatch ", you have Zero argumnet constructor as below so when you will instantitae DeleteDownloadHitCountBatch class, you need to use this zero argumnet cosstructor but in your scheduled class you have used one argumnet construcor and parameter is a string(soql) as so this one argumnet constructor is not exist in your batch class, so you need to use only zero argumnent constructor for this as per below code. Anyways same soql you have already placed in your batch class constructor so no need to pass it again during instantiation of the batch class.
please let me know if you need further help.
Thanks,
Debasis
Is your problem resolved, if yes then please mark it as a resolved so that it will be helpful to others in the future.
Regards,
Mahesh