Scheduled jobs are a powerful feature in Salesforce that allow developers and administrators to automate time-bound processes like data cleanup, batch processing, email campaigns, and more. With the introduction of the Resume and Pause functionality for scheduled jobs, Salesforce has taken job orchestration and control to a new level.
In this blog, we’ll explore what scheduled jobs are, how the new Resume and Pause feature works, and how to use it via Apex syntax, along with real-world use cases.
What are Scheduled Jobs in Salesforce?
Scheduled jobs let you run Apex classes at specific times. You can schedule them using the System.schedule method or through the Salesforce UI under Setup > Scheduled Jobs. These jobs implement the Schedulable interface and contain an execute() method.
Example:
SampleScheduledJob.apxcglobal class SampleScheduledJob implements Schedulable { global void execute(SchedulableContext sc) { System.debug('Scheduled Job Executed'); } }
Scheduling this job:
String cronExp = '0 0 22 * * ?'; // Every day at 10 PM System.schedule('Nightly Job', cronExp, new SampleScheduledJob());
New Feature: Pause and Resume Scheduled Jobs
Before this feature, managing scheduled jobs was inconvenient. Once scheduled, you could only delete or let them run. With the Pause and Resume feature, Salesforce now gives you the ability to temporarily disable a scheduled job and resume it later without losing configuration.
This is particularly useful in:
- Deployment windows
- Data migrations
- System maintenance periods
- Avoiding partial runs during large changes
Pause and Resume in Apex – Syntax
As of the latest releases (Winter ’25+ / pilot), Salesforce provides experimental Apex syntax for pausing and resuming scheduled jobs programmatically.
Pause a Scheduled Job in Apex
You can pause a scheduled job using its Job ID from CronTrigger.
Id jobId = [SELECT Id FROM CronTrigger WHERE CronJobDetail.Name = 'Nightly Job' LIMIT 1].Id; System.pauseJobById(jobId);
Resume a Paused Job in Apex
System.resumeJobById(jobId);
Pause/Resume via Setup UI
To Pause:
- Go to Setup > Scheduled Jobs
- Select the job
- Click Pause
To Resume:
- Go to the Paused Jobs section
- Select the job and click Resume
Real-World Use Case: Deployment Scenario
Let’s say you're deploying a new feature that updates Account data. You don’t want your scheduled job to run halfway through the deployment.
Steps:
- Use Apex or Setup UI to pause the job:
System.pauseJobById(jobId);
- Complete the deployment safely.
- Resume the job post-deployment:
System.resumeJobById(jobId);
No need to delete or reconfigure the job!
Conclusion
The Pause and Resume feature for scheduled jobs adds much-needed flexibility and safety to job management in Salesforce. Whether you're deploying code, migrating data, or handling maintenance, this small feature can make a big difference.
And now with Apex-level control, you can integrate job state management directly into your deployment scripts and lifecycle events!