Salesforce is one if the leading CRM platforms used across the globe. According to Girikon’s Salesforce Consultants it is one of the largest and widely used CRM software in the market. Salesforce has two types of storage i.e. Data storage and File storage. File storage includes attachments, items a user has uploaded into the Documents tab, and Salesforce CRM Content. Contact Manager, Group, Professional, Enterprise, Performance, and Unlimited Editions are allocated 10 GB of file storage per org. Essentials edition is allocated 1 GB of file storage per org. All other data, including activities is considered a record and counts towards your Data Storage allocation. Data Storage limits for every Contact Manager, Group, Enterprise, Professional and as well Performance editions are calculated at either 1 GB or on a per user limit (20 MB per user) whichever is required for production orgs. For a business keeping their expenses in check keeping an eye on storage limits is the main goal.

We all agree that Salesforce is a great CRM but when it comes to licence pricing it can get very expensive when you consider licence per users etc. If the organisation’s concern is storage cost and the users are continually uploading data at an alarming rate, then it is important to apply Girikon’s strategy for managing the orgs data. Emails and Cases are very crucial pieces of information and they can take up a lot of space. Each email takes around 2Kb – 10Kb data (it varies on a case by case basis depending on the email content) and each attachment sent alongside the email can be up to 20Mb. Management of the orgs data can be more effective by managing by archiving and then restoring the emails when needed.

The Archiving strategy is very simple, and it has proved to be very effective. Our Salesforce Consultancy Services team often advise users to use the two custom buttons which are Archive and Retrieve which does all the work for the users. When clicking on archive, the emails in the related list gets archived or gets stored as an attachment.

  • Before sending or receiving the email.
Salesforce Orgs storage

  • After sending the email. The email is showed in the email related list and the data storage is increased.
Salesforce Orgs storage Salesforce Orgs storage

  • When the archive button is clicked.

Salesforce Orgs storage

A visual force page pops up to ask you that “Are you sure you want to archive?”



Salesforce Orgs storage

  • After archive the email gets into the attachments and the data storage is decreased.

Salesforce Orgs storage Salesforce Orgs storage

Let us explore the backend logic behind the storage when an email is sent or received, it creates a record in emailMessage object and the attachments along with that email creates a record in attachment object in salesforce. The record that is created has a parent Id equals to the case Id and the attachments that were sent along with that email have their parent Id equal to the email record Id. So, when we hit on archive button the code runs in the background which creates a new record or file i.e.  email(emailId).txt in the attachment object which have the email and its details such as: – BccAddress, CcAddress, TextBody/HTML body etc. And for the attachments that were delivery with the email, the parent Id of those gets re-parented and now is equal to the caseId. After that the email record in the emailMessage Object gets deleted which reduces the Data Storage.

Email retrieving is also necessary after the user has archived as per the step above to be viewed at a future date. There is also an opportunity for the user to delete the emails.

  • Click on retrieve button.
  • Salesforce Orgs storage

  • A visual force page pops up and asks, “are you sure you want to retrieve?”


  • Salesforce Orgs storage

  • The email is retrieved. And the data storage is increased.


Salesforce Orgs storage Salesforce Orgs storage

Let us explore the backend logic behind the storage when an email is retrieved. Code is written in such a way that it reads body of email(emailId).txt and then creates a new record in the emailMessage object from it. For the email attachments, they are again re-parented back to the email with the help of a custom field which the system created in the emailMessage Object to retrieve the attachments. The custom field contains the old Id of the email when it was not archived. After all this is done the code deletes the email(emailId).txt file from the attachments.

About Girikon

Girikon is a Salesforce Consulting, Oracle Gold, Microsoft Application, Adobe Bronze Technology Partners. We are also ISO 9001 Quality Management and ISO 27001 Data Management system certified.  Girikon’s Headquarters are in the US, with offices in AUS and Technology centre in Noida India with over 150 employees across the three offices. Girikon is a Salesforce Consulting Company that provides cost effective services through a hybrid offshore/onshore model, quality delivery and great testimonials.  






About Author
Sourabh Goyal
Sourabh Goyal is currently a Salesforce Consultant at Girikon working for the company for nearly five years. Experienced and Salesforce Certified x 3 with a history in the information technology and services industry, skilled in Salesforce.com, JQuery, SQL, Creative Style Sheets (CSS), Java and HTML graduated from National Academy, Alwar.
Share this post on: