From this comment -
I have been using SF migration tool, but encounter a road block: we have quite a few scheduled apex job in the system. Although the jobs may not run, the migration tool will just error out. Do you run into issue with schedule jobs? If so, how do you resolve them? Thx.
We have an apex class that we use to abort and schedule all jobs before and after deploys. We currently run this manually by calling the methods with anonymous apex (from the dev console or SoqlXplorer), but we would ideally build this in as a step in our Bamboo deployments.
public with sharing class ProcessScheduledJobs { public static void scheduleAll(){ System.schedule('jobname1','0 0 2 ? * SAT', new SomeSchedulableClass()); System.schedule('jobname2','0 1 * * * ?', new SomeOtherSchedulableClass()); } public static void abortAll(){ // CronJobDetail.JobType = '7' represents scheduled apex jobs for(CronTrigger ct : [SELECT Id FROM CronTrigger WHERE CronJobDetail.JobType = '7']){ system.abortJob(ct.Id); } } }
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.