Apex_cleaner.zip Today
ApexCleaner.cls : The main engine containing logic to query and delete records (e.g., old Debug Logs, stalled Flow Interviews, and expired Tasks).
: Update the Apex_Cleaner_Setting__mdt records to define your data retention policy.
: Utilizes the Compression namespace (available in Spring '26) to archive data before deletion if backups are required. Deployment Instructions Apex_Cleaner.zip
The package is designed for Salesforce environments to automate the removal of obsolete data, temporary logs, and orphaned records. This utility helps maintain storage limits and improves system performance by leveraging Apex Compression for efficient metadata and log handling. Package Structure & Components The .zip file contains the following directory structure: classes/
Apex_Cleaner_Setting__mdt : A Custom Metadata Type to store retention periods (e.g., "Delete logs older than 30 days"). ApexCleaner
CleanerTest.cls : Unit tests ensuring 75%+ code coverage for deployment.
: Automatically deletes ApexLog records to prevent storage bloat. CleanerTest
: Identifies and removes Attachment or ContentDocument records that are no longer linked to active parent records.
