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.
​

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

The Email Scrubber Archive Records batch process can also be run via apex as needed.
​
Declutter_Setup__mdt dSetup = declutterUtility.getSettings();
emailscrubber.archiveRecords batchApex = new emailscrubber.archiveRecords();
Id batchprocessid = Database.executeBatch(batchApex, Integer.valueOf(dSetup.EmailScrubber__Archive_Batch_Size__c));
Review the Results
Upon batch completion, Email Message records will be archived and available in the archive object.​