1

When i try to create a scheduler class I am getting an error

Method does not exist or incorrect signature: void schedule(String, String, UpdateCloseDateOpportunityBatchClass) from the type System

My scheduler class :

global class SchduleBatchUpdateOppCloseDate implements Schedulable{
global void execute(SchedulableContext SC) {
  //UpdateCloseDateOpportunityBatchClass p = new UpdateCloseDateOpportunityBatchClass();
  String sch = '0 0 0 1 JAN,APR,JUL,OCT ? *';
  System.schedule('Quarter Job', '0 0 0 1 JAN,APR,JUL,OCT ? *', new UpdateCloseDateOpportunityBatchClass ());
}   
}

Do any one have any idea what is wrong with the code. I am using Salesforce.com API Version is 41.0

2 Answers 2

0

You need to pass instance of scheduler class while you are passing instance of batch class. So you are getting the incorrect signature error.

global class SchduleBatchUpdateOppCloseDate implements Schedulable{
    global void execute(SchedulableContext SC) {
      UpdateCloseDateOpportunityBatchClass p = new UpdateCloseDateOpportunityBatchClass();
      Database.execute(p);
   }   
}

Then run this code

System.schedule('Quarter Job', '0 0 0 1 JAN,APR,JUL,OCT ? *', new SchduleBatchUpdateOppCloseDate());
0

Old question I know but in case it helps anyone else the reason I was getting this error was because I was passing in a DateTime object instead of a CRON String for the date parameter of the schedule() call.

So this failed (obviously):

System.schedule('My Job',myDateTimeObject,myScheduleClassInstance);

And this worked:

System.schedule('My Job',myDateTimeCRONString,myScheduleClassInstance);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .