0

While I am trying to deploy a Change set, I couldn't find an Apex Scheduled Job(component) that contains a job which was scheduled to run once every week. How to get that scheduled job configuration deployed from a Sandbox to the Production without the need of re-configuring it on the Prod org.?

2

You do have to manually reconfigure the job. You can query the CronTrigger table to get a copy of the CronExpression, if that helps you. Usually, what most developers do is create a static method that helps configure such jobs in the future, like this:

SomeScheduledClass.schedule();

The method for which typically looks like:

public static void schedule() {
  System.schedule('JobName','0 0 0 * * SUN', new SomeScheduledClass());
}

This leaves administrators/deployment admins with just running a single line of code. This is process that we follow, and it has worked quite well for the past three years to minimize the amount of code our deployment admins needs to learn while making sure things get turned on correctly.


You can also schedule jobs via UI, but if you do this, remember to document it so that the job can be renewed. There are limits to how many times you can request your scheduled job to repeat, unlike the code-based version, which allows your job to run indefinitely without renewing the job's configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.