When using Email-to-case in Salesforce, most of the time we may hit the org storage limit, since # of emails are increasing day by day. Here are the few options to increase the org storage.
- Delete the Unnecessary/old files & data
- Get additional Storage
- Archive old files/Data
Here, we are going to see the last option: Archive the Email Message records (for the older closed cases) to increase the org storage.
We have a custom Option to archive Emails using Apex.
Flow for the implementation:
We can schedule the batch class daily to automatically archive the emails and free up some space in our Salesforce org.
Case before archiving:
Case Emails Before Archiving:
Case Email Message Files:
Case Chatter post Before Archiving:
Execute the batch:
Case Record After Archiving:
Case Emails After archiving:
Files After Archiving:
Case Comments After Archiving:
Email after batch completed:
- Even though archiving reduces data storage, our PDF files occupied the org files storage. In step 2, we need to move the created Pdf from Salesforce by using s3- link and other similar managed packages.
- Within the single PDF document, an agent can get 360 views & detailed history of the case. They can see the emails, attachments, Chatter details within the pdfs.
Please refer to the GitHub link below for full code: https://github.com/kanchanaraju/EmailArchivingSF