Loading
Salesforce now sends email only from verified domains. Read More

Scheduled Apex Jobs Not Copied to Refreshed Sandbox

Publish Date: Mar 19, 2024
Description

AsyncApexJob is the underlying database table on the Salesforce Platform that tracks asynchronous Apex execution history, including the schedule definitions for Scheduled Apex jobs.

When a sandbox is refreshed from production, administrators may notice that none of the Scheduled Apex jobs that existed in the production org appear in the refreshed sandbox. Checking Setup in the sandbox shows no scheduled jobs listed under Apex Jobs or Scheduled Jobs.

This behavior is expected on the Salesforce Platform. The AsyncApexJob object, which stores Scheduled Apex job definitions and execution history, is not copied during a sandbox refresh. As a result, no Scheduled Apex jobs from production are present in the refreshed sandbox after the refresh completes.

Resolution

This article explains how to restore Scheduled Apex jobs in a refreshed sandbox on the Salesforce Platform after confirming that the absence of scheduled jobs is expected behavior.

Because AsyncApexJob records are not copied during a sandbox refresh, all Scheduled Apex jobs must be manually re-scheduled in the refreshed sandbox after the refresh completes.

 

Post-Refresh Cleanup Steps

Follow these steps to re-create Scheduled Apex jobs in the refreshed sandbox:

  • Log in to the refreshed sandbox.
  • Go to Setup and search for Apex Classes in the Quick Find box.
  • Click Schedule Apex.
  • In the Schedule Apex dialog, enter the following details:
    • Job Name: Enter a name to identify the scheduled job.
    • Apex Class: Select the Apex class that implements the Schedulable interface.
    • Frequency: Select Weekly or Monthly, and configure the schedule as needed.
    • Start Date and End Date: Set the date range during which the job should run.
    • Preferred Start Time: Set the time at which the job should execute.
  • Click Save.
  • Repeat these steps for each Scheduled Apex job that needs to run in the sandbox.
Additional Resources
Knowledge Article Number

001235886

 
Loading
Salesforce Help | Article