Here’s the comprehensive solution to get your archival working:
1. Archival Policy Criteria Review
Your policy criteria needs to be more specific. Navigate to Setup > Data Archival Policies > Your Policy and verify the SOQL matches:
SELECT Id FROM Case
WHERE Status = 'Closed'
AND ClosedDate < LAST_N_MONTHS:18
AND IsArchivalReady__c = true
Add a custom checkbox field IsArchivalReady__c to flag cases that have completed all business processes.
2. Automation Dependency Resolution
Your triggers and flows are preventing archival because they create runtime dependencies. Solutions:
- Modify your case closure flow to check the
IsArchivalReady__c field. Set it to true only after all related record updates complete
- Update your notification trigger to include a condition:
if (!Trigger.isDelete && !System.isBatch()) to skip execution during archival batch jobs
- Consider converting your after-update trigger to an asynchronous queueable job that respects archival flags
3. SOQL for Identifying Eligible Records
Run this diagnostic query to find cases that should archive but aren’t:
SELECT Id, CaseNumber, ClosedDate,
(SELECT Id FROM CaseComments),
(SELECT Id FROM EmailMessages)
FROM Case
WHERE Status = 'Closed'
AND ClosedDate < LAST_N_MONTHS:18
If cases have more than 100 related CaseComments or EmailMessages, they might exceed archival batch limits. You’ll need to archive related objects first.
4. Trigger Impact Mitigation
Create a custom setting called ArchivalMode__c with a checkbox field. In your triggers, add:
if (ArchivalMode__c.getInstance().IsActive__c) {
return; // Skip trigger logic during archival
}
Enable this setting before archival runs, disable after completion.
5. Storage Impact Resolution
Once automation conflicts are resolved, schedule your archival policy to run weekly during off-peak hours. With 87% storage capacity, you should see immediate relief. After the first successful run, monitor the Archival History related list to confirm record counts match your SOQL query results.
6. Flow Optimization
For your case closure flow updating related objects - modify it to use a ‘Record-Triggered Flow’ with ‘Fast Field Update’ disabled. Set the flow to run asynchronously, which removes it from the archival dependency chain.
Implement these changes in a sandbox first, then run a test archival on 100 records to validate. Once confirmed working, deploy to production and execute a full archival run. Your storage should drop to 60-65% within 48 hours of the first successful purge.