top of page

Targeted Detection

Email Scrubber's Targeted Detection leverages your Salesforce data to identify email messages that are no longer needed for day to day business transactions.  

For example, a common business use case may identify targeted email messages as email messages where

  • The Case is Closed

  • The Case has been closed for more than 18 months

  • The Case was not related to Product X

Configure Declutter Setup Custom Metadata Type

All Email Scrubber processing logic is controlled by the Declutter Setup Custom Metadata Type. Please review the documentation for a complete list of its capabilities.

image.png

As we are interested in archiving any email message related to a case that has been closed more than 18 months, we will set the Archive Batch where condition to:​​​​

WHERE ParentId != null
AND Parent.IsClosed = true
AND Parent.ClosedDate < LAST_N_MONTHS:18 

Schedule the Archive Records Batch

image.png

For clients on Email Scrubber version 5.0 and higher, a one-time Email Scrubber Archive Records batch can be executed directly from the Email Scrubber app page.  

image.png

For clients on an Email Scrubber version prior to 5.0, a one-time Email Scrubber Archive Records batch can be executed via apex with the following command.  

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

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

Review the Results

Upon batch completion, Email Message records will be archived and available in the archive object.

Notice

When Email Scrubber archives an EmailMessage, only the primary relationship is preserved.

EmailMessageRelation records (the Who relationships such as Contacts, Leads, and Users referenced in the email) are not retained in the archive object. Any participant‑level context is preserved only to the extent that it exists in the fields copied onto the archive record itself (e.g., raw address strings, header fields, or any metadata your org has chosen to store).

As a result:

  • Archived emails will not maintain their original Who‑related associations

  • Multi‑recipient context is not reconstructed in the archive

  • Reporting or compliance processes that rely on EmailMessageRelation data will not have access to those relationships once the email is archived

bottom of page