top of page

Case "Has Archived Records" Field

For instances where you want a field on the Case to indicate that archived records exist, Email Scrubber provides the ability to set a flag field automatically.

This feature is shipped as inactive by default. To enable it, set the Has Archive Is Active option to true on the Declutter Setup metadata record.

Default field: Case.EmailScrubber__Has_Archived_Records__c

You can substitute your own field through configuration by entering its API name in the Has Archive Records API Field Name setting on the Declutter Setup metadata record. The field must be a checkbox field on the Case object.

⚠️ Before Activating

⚠️ Before activating: make sure the running user has edit access to the configured field. Without field-level access, the flag updates will fail silently.

Declutter  CMDT Setup

The process is implemented as a batch job to avoid runtime issues in orgs with large data volumes. You have two options for running it:

  • Automatic: set the Has Archive Is Active configuration option to true, and the batch runs automatically after each archive batch completes.

  • Scheduled: leave the configuration option inactive and schedule the batch independently on your own timing.

image.png

One-time Execution of batch via Apex

The batch can be executed via Apex to run one time, as needed. Open the Developer Console (or any Anonymous Apex window) and execute:

 emailscrubber.setHasArchiveRecords batchApex = new emailscrubber.setHasArchiveRecords();

 ID batchprocessid = Database.executeBatch(batchApex, 200);  

bottom of page