ruruskyi
ruruskyi

Reputation: 2087

Get list of scheduled jobs by name/type

I wrote schedulable class which is a batch at the same time. I'm scheduling it like so:

String cronExpression = String.format('0 {0} {1} * * ?', new List<String> { String.valueOf(minute), String.valueOf(hour) });
String jobName = 'roomSyncronizationJob' + Integer.valueOf(hour);
return System.schedule(jobName, cronExpression, batch);

Then I have a page to display form for scheduling and table that should display scheduled jobs. For the moment, it displays all scheduled jobs in the system.

My question: Is there any way to get the jobName to be able to filter out jobs that was not scheduled by the code above? Does anybody know any other workaround except for storing all scheduled job ids in the database?

Upvotes: 1

Views: 3400

Answers (2)

user5451924
user5451924

Reputation: 11

Old, but i was searching for this. CronTrigger contains the field CronJobDetailId. CronJobDetail has the field "Name"

Upvotes: 1

Chirayu
Chirayu

Reputation: 4901

There is one standard object "CronTrigger". May be this object will help you to get name.

Upvotes: 1

Related Questions