we had a an old scheduled apex job running every 7 hours setup by a consultant. we deleted the job. we know the apex class that it used to call but we do not currently know the exact cron query or job details. is there anyways to look at the details just based on past apex job id.
-
1Possible duplicate of Apex cron job command to schedule an apex job to run every 4 hours daily– Mark PondMay 2, 2019 at 19:36
-
@MarkPond Definitely not precisely a dupe; it's one thing to ask how to schedule, another to how to recover a schedule.– sfdcfoxMay 2, 2019 at 19:37
1 Answer
There's no way to get the precise details. Even if you know the cron expression, you might not know all the parameters that were passed in to the class (which also becomes part of its state). You can try scheduling it using System.schedule, but you may encounter problems if additional data/parameters are required. Also, it appears that a query for deleted jobs will not return any values, so there doesn't appear to be an easy way to recover the details.
As far as scheduling it, you can try this Execute Anonymous script:
System.schedule('JobName','0 0 */7 * * ?', new ScheduledJobClassName());