---
schema_version: "1"
id: 16d5f94e05b5b601e505c945be2752b11a259d668512839a28be27ac41831950
title: Specify the Number of Async Jobs to Delete
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/release-notes/260-0-0/rn_apex_purgeOldAsyncJobs_overload.md
canonical_url: https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_purgeOldAsyncJobs_overload.htm&release=260&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: a2c450319f84b87cfea5f7ed6761cceb332fff7b2d44901c8a78618f22afc2c2
description: Use the new method overload for purgeOldAsyncJobs() to specify the number of oldest, completed async jobs in your org to purge. Providing an upper bound for the number of records to delete enables incremental progress when large volumes of records are to be deleted.
products:
  - Cross Cloud Packages Solutions
release: "260"
---
# Specify the Number of Async Jobs to Delete

Use the new method overload for `purgeOldAsyncJobs()` to specify the number of oldest, completed async jobs in your org to purge. Providing an upper bound for the number of records to delete enables incremental progress when large volumes of records are to be deleted.

**Where:** This feature is available in API version 66.0 and later. This feature is available in Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions.

**How:** Specify the number of completed async jobs to delete, starting from the oldest jobs that finished before the specified date. This example shows how to delete up to 1000 job records for jobs that finished before today’s date.

```java
Integer maximumNumberOfJobsToDelete = 1000;
Integer count = System.purgeOldAsyncJobs(
    Date.today(), 
    maximumNumberOfJobsToDelete
);
System.debug('Deleted ' + count + ' old jobs.');
```

#### See Also

- [_Apex Reference Guide_: purgeOldAsyncJobs(dt, numOfJobs)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_system.htm#apex_System_System_purgeOldAsyncJobs_2)