Custom Email Archiving

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. 

Demo: 

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: 

Created PDF: 

Email after batch completed: 

Limitations: 

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

Advantages: 

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

Sample Code: 

Please refer to the GitHub link below for full code: https://github.com/kanchanaraju/EmailArchivingSF  

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Harnessing Generative AI in Healthcare Insurance: Streamlining Operations and Enhancing Member Insights

Healthcare insurance providers are navigating new ground and capitalizing on new opportunities made possible through artificial intelligence. AI can be utilized to lower costs for payers and improve the member experience as well as the overall health and well-being of members, leading to greater member satisfaction and improving trust and reputation for the payer’s brand.

Read Article »

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.