You need to sign in to do that
Don't have an account?
Alejandro Rosano
How can I check in Apex if a batch is scheduled?
I am calling a batch through a system.scheduleBatch(BatchableClass(query), 'Job Name', MinutesToExecute) method. How can I check if the batch job Job Name is already scheduled?
Thanks in advance.
Thanks in advance.
First you need to query the CronJobDetail Object using the name of the job.Below is the link for cronjobdetail object:
https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_cronjobdetail.htm
Once you get the id of the desired cronjobdetail, using that id, query the crontrigger obejct and get the nextfiretime., to see if it has any future runs left!, below is the link for crontrigger object
https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_crontrigger.htm
Below link will help you framing the queries:
http://docs.releasenotes.salesforce.com/en-us/winter14/release-notes/rn_186_apex_job_name_type.htm
Hope it helps:
Cheers!
Thanks,
Balaji
You can check in scheduled job in setup. If you have scheduled the job already then it will be shown there.
This is how you can check whether your batch job is scheduled in APEX.
Note - I know this was posted long back in 2015 but few clarification were missing, thus thought that I should post this to help future trailblazers.
Hope this helps.
--
Thank You
Mustafa