function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mdelgadomdelgado 

Specifying an end date for an apex scheduled job

Hello,

 

I've implemented a scheduler, but I would like to be able to specify and end data as part of my cron parameter request.  Currently I have the following set

 

System.schedule('SEO Project Renewal Reminder', '0 0 3 ? * MON-SUN', new SEO_Project_Renewal_Reminder());

 When I go to view the added scheduled job, there is not end date set and it seems that the end date field is required.

 

questions:

 

1) Is the end date field needed for it to work?

2) How can I specify an end date in my cron parameter?

 

thanks,

 

Mirko

DiscussionDiscussion

 

 

The Cron Expression itself contains the start time, duration and iterval of Scheduled job run. This Cron Expresssion is necessary parameter for System.schedule method.

 

Like in below example Cron Expression shows that the particular Scheduler class should run every day at 1 PM. You can also define Months the class should run, year the class should run. one more thing Year is the optional parameter.

0 0 13 * * ?Class runs every day at 1 PM.
mdelgadomdelgado

Hello,

 

Thanks for your reply.  How would you modify you response to run starting today (12/6/11) gor 1 year (12/6/12) ?

 

thanks for your help,

 

Mirko