You are using an older browser that might negatively affect how this site is displayed. Please update to a modern browser to have a better experience. Sorry for the inconvenience!

Winter 15 – Deployment Features in Apex Schedule class


Are you trying to abort a running job in a production instance and recreating as same as before while deploying?

Here is the new feature to avoid aborting and recreating the job every time.

Currently, if we deploy any components that were referenced by Apex jobs and were in pending or in progress in another organization, it results in deployment failure.

For example, if we deploy an Apex schedule class and there is already a scheduled job that corresponds to this class, we cannot deploy the existing class, and the entire deployment fails and throws an error message as “Schedulable class has jobs pending or in progress“.

To overcome this, we need to abort the job that is running in another organization and need to recreate the new job as same as before, after the deployment process. This involves lot of manual work as well as it consumes more time.

Winter ’15 Feature:
From Winter ’15, we will be having a checkbox named Allow deployments of components when corresponding Apex jobs are pending or in progress.

By enabling this checkbox, we can deploy the components associated with corresponding jobs including scheduled jobs, batch jobs, and future methods without deployment failure.

From Winter ’15, Deployment connections have been renamed to Deployment settings.

sc0610-1.png

Steps to enable the checkbox:
To enable the check box, follow the steps given below

1. From Setup click Deployment Settings
2. Enable the Allow deployments of components when corresponding Apex jobs are pending or in progress checkbox.

sc0610-2.png

3. Click Save.

This option applies to change sets and deployments started through the Metadata API.

By using this Winter ’15 feature, we do not have to abort Apex jobs and do not have to recreate the new job after the deployment process. Hence, it reduces some time consumption as well as manual work. When the size of the organization is higher, a considerable amount of time is saved.

Reference: Salesforce Winter ’15 Release Notes