I have just found a very strange behavior regarding Batch.
If I have a Batch and run it using the method Database.executeBatch()
, a new record inside AsyncApexJob
table is created and I can use ApexClassId
field to find it using my class name.
For the Schedulable
I have the same behavior regarding AsyncApexJob
table and I have a new record inside the CronTrigger
table.
Instead, if I have a Batch and I decide to schedule it using the method System.scheduleBatch()
I receive a new record only inside CronTrigger
and nothing inside AsyncApexJob
!
In this case, I am not able to find if a specific Batch is "scheduled" or not because using the record inside CronTrigger
table I am not able to retrieve info about that class.
Do you have any suggestion?