Skip to main content

Archiving policies - Task & Event records

Explaining how counts in Tasks and Events can mismatch with Salesforce storage

Written by Alex Walter

When you build an archiving policy for Task or Event records, Gearset may preview far fewer records than Salesforce reports for that object — for example, 1M in Gearset versus 5M in Salesforce. This is expected behaviour caused by how Salesforce stores archived Activities in sandboxes, not a limitation in Gearset.

Why it happens

Salesforce automatically "archives" Task and Event records that are closed and more than a year old - see docs. These records are flagged with isArchived = true and moved to separate storage internally in Salesforce. However, these records still count toward your Salesforce storage total, which is why the object's overall record count stays high.

Standard Salesforce queries exclude archived records by default, so tools that count them can differ from the storage total (using queryAll vs query). Gearset's archiving tools will query archived records too, so in Production Gearset can see them.

The full-copy sandbox exception

When you create a full-copy sandbox, Salesforce only copies the non-archived records, but the sandbox's reported record count still includes the archived records.

This means the archived Tasks physically aren't in the sandbox, so no tool can retrieve them there. If you're testing archiving on a full-copy sandbox, this is the most likely reason Gearset isn't fetching your older Tasks. Validate against production data to see the true picture.

Example

In my org I see the following for Storage Usage:

Note there are 12,345,678 Task records:

Sandbox

In my Sandbox I pick up only a small number of records that match the criteria (2,007) and a much smaller total records (1,030,489)

Production

However running this in my production org, it picks up a large number of matching records (10,245,657) and the full count of total records (12,345,678).

Did this answer your question?