There are a few ways to retrieve all records in the Task and Event objects in Salesforce.
Salesforce automatically archives activities (Tasks and Events) that are over one year old. Standard SOQL query() calls automatically exclude archived records where the isArchived field is set to true. To retrieve all records — including archived ones — you must use an alternate approach.
You can also filter on the isArchived field to retrieve only archived records. While archived records can be updated or deleted, the isArchived field itself cannot be updated directly.
Use Workbench or any API tool and select the option Include Deleted and Archived Records, which uses the queryAll() method. The queryAll() method requires an API connection setup, as it can only be used via an API call.
For more information on the queryAll() API call, see:
ALL ROWS is only intended for use in Apex SOQL queries. The equivalent of ALL ROWS in the API is to call queryAll() instead of query().
Note: You cannot use ALL ROWS in the Developer Console's Query Editor because the Query Editor does not execute queries as Apex code — it executes them directly as REST API calls.
Reference: Querying All Records with a SOQL Statement
Querying All Records with a SOQL Statement
Salesforce Support can increase the archive period for your org, allowing you to retrieve more archived records. Contact Support to request this change.
000386329

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.