Loading
ただいま大変多くのお問い合わせをいただいており、ご連絡までにお時間を頂戴しております続きを読む

Retrieving All Records from Task and Event Objects Using queryAll() or ALL ROWS in Salesforce API

公開日: May 29, 2026
説明

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.

解決策

Option 1: Use queryAll() via Workbench or API Tool

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:

Option 2: Use ALL ROWS in Apex SOQL

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

 

Option 3: Request Archive Period Extension from Salesforce Support

Salesforce Support can increase the archive period for your org, allowing you to retrieve more archived records. Contact Support to request this change.

ナレッジ記事番号

000386329

 
読み込み中
Salesforce Help | Article