I want to schedule a apex classes through apex code and need to have a cron expression with a fix startdate & enddate. It needs to be also possible to set the startdate & enddate like below:

-Start: 30.10.2014

-End: 6.02.2015

-Time: 00:00


How can i handle this issues ?


Using Crone expression it is not possible. However, as a workaround, in your Scheduler you can check date every time before execution. If you find date then remove Scheduled job from Queue.

You can check this documentation to query CronTrigger - http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm

Also, you can check this URL which will help you to make Cron expressions- http://www.cronmaker.com/

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.