3

Is there a way to get the next execution date of a scheduled job ?

I have my Apex code :

Scheduler scheduler = new Scheduler(); // Scheduler class implements Schedulable
String expr = '0 0 13 * * ?';
String id = system.schedule('Test', expr, scheduler);

And then I would like to know, with CRON expression or in the Scheduler class, what will be the date of the next execution, in this case : tomorrow at 1PM ?

1 Answer 1

5

You can query CronTrigger for NextFireTime.

For example; SELECT Id, NextFireTime FROM CronTrigger

This will return a datetime type.

For more info on CronTrigger class; https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_crontrigger.htm

0

You must log in to answer this question.

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