Managing file storage in your Salesforce Org 
Tags: salesforce, beginners, productivity, tutorial
Published: 2019-11-26 13:38:13

---
title: Managing file storage in your Salesforce Org 
published: true
date: 2019-05-28 10:29:03 UTC
tags: #Salesforce, #Beginners,#productivity, #tutorial
canonical_url: https://www.girikon.com/blog/girikons-salesforce-consultant-provides-the-right-advice-in-managing-your-salesforce-orgs-storage/
---

Salesforce is one if the leading CRM platforms used across the globe. According to Girikon’s **[Salesforce Consultants](https://www.girikon.com.au/salesforce-consultant/)** 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](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage-1-1.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage-1-1.png)
  
- **After** sending the email. The email is showed in the email related list and the data storage is increased.
[![Salesforce Orgs storage](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage2.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage2.png)[![Salesforce Orgs storage](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage3.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage3.png)
  
- When the archive button is clicked.
[![Salesforce Orgs storage](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage4.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage4.png)  

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

  
[![Salesforce Orgs storage](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage5.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage5.png)
- **After** archive the email gets into the attachments and the data storage is decreased.
[![Salesforce Orgs storage](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage6.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage6.png)[![Salesforce Orgs storage](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage7.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage7.png)

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](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage8.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage8.png)  
- A visual force page pops up and asks, “are you sure you want to retrieve?”
  
[![Salesforce Orgs storage](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage9.png)](https://www.girikon.com/wp-content/uploads/2019/0%0A5/Salesforce-Orgs-storage9.png)- The email is retrieved. And the data storage is increased.
  
[![Salesforce Orgs storage](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage10.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage10.png)[![Salesforce Orgs storage](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage11.png)](https://www.girikon.com/wp-content/uploads/2019/05/Salesforce-Orgs-storage11.png)

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.

 

#   
  
  
  
  

The post [Girikon’s Salesforce Consultant provides the right advice in managing your Salesforce Org’s storage](https://www.girikon.com/blog/girikons-salesforce-consultant-provides-the-right-advice-in-managing-your-salesforce-orgs-storage/) appeared first on [Salesforce Consulting Company | United States | Phoenix, Arizona](https://www.girikon.com/).