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
Eager-2-LearnEager-2-Learn 

Scheduled Jobs / CronTrigger object

Hi,

 

Up front I do not see any scheduled job reporting capabilities--bummer!

 

So I thought what a great opportunity for me to write some code and iterate through the CronTrigger table--bummer again!


To be specific my goal is to be able to report on all scheduled reports that are a year from reaching the scheduled end date.  Thr ConTrigger object does not seem to have a field for what is scheduled, be it a report or an apex class.

 

Is there any undocumented information for a possible hidden field that gives me this information on the CronTrigger object?

 

I see this is a big issue and high maintenance because you can only schedule 5 years out.  If you are not baby-sitting these jobs then you could potentially code or reports that stop running!

 

Any support on this would be appreciated very much.

 

 

JeffStevensJeffStevens

Tom - ever get any more information on the CronTrigger object?  I'm querying it now - but not finding the field Name.  (ie Scheduled Job Name)

 

Thanks

Eager-2-LearnEager-2-Learn

No I have not Jeff.  This was a low priority; therefore, I have not looked any further.

scott.fraserscott.fraser
You can access the name using the following SOQL: SELECT Id, CronJobDetail.Name, NextFireTime, PreviousFireTime, State, StartTime, EndTime, CronExpression, TimeZoneSidKey, OwnerId, LastModifiedById, CreatedById, CreatedDate, TimesTriggered FROM CronTrigger
Eager-2-LearnEager-2-Learn
Hi Scott,

This helps to tell me that I have something coming up that could be unscheduled; however, it doesn't get to the specifics scheduled record so that I could update the schedule.

I could add the where clause "WHERE State <> 'DELETED' AND EndTime = NEXT_YEAR" and have the results emailed to me once a year but it would require manual intervention to review the Apex Jobs GUI interface to match things up.  Unless I am missing something?

Is there a way to get to the specific scheduled interface page for each specific record returned? I tried the ID but it does not work.