Mass Download Attachments Tool

Every year Salesforce has 3 releases which are full of new and interesting features. However, every once in awhile, Salesforce decides to retire a well known feature. This is going to be the case with Winter ‘18. As part of the release, we will be saying ‘adios’ to Attachments and ‘hello’ to Files as the main supreme for all docs, images, etc. Along with that comes some challenges and questions –

  1. How will I move my current Attachments over to Files?
  2. Will I be able to see my Attachments after the update?
  3. Will I like the next Fantastic Beasts and Where to Find them movie?
  4. How can I quickly get all of my attachments as a backup before converting them into Files?



Questions 1 and 2 are easy to answer and come straight from the Salesforce release documentation.

  • (Q1) As part of the Summer ‘17 release, there will be a new feature designed to assist those with this change. Although I haven’t seen it yet, I am sure it will be a delightful experience.
  • (Q2) According to the existing documentation, Winter ‘18 simply removes the Add Attachment button, while still allowing you to view your existing attachments.
  • (Q3) This one is still a little hazy for me, given we only currently know who is playing young Dumbledore.

 

Answering question 4 actually brings me to the purpose of this post.

A little while back, my partner and I designed and developed an open-source tool for downloading all of the Attachments in a single org. The original reason for creating such a tool was actually very different than the one noted above. The use case came from the a short meeting I had with the executives at my company, who basically said: “Lena, our company needs to be able to download all of *bleep* type of file because someone higher needs them ASAP. They have all been uploaded on the Attachments object. Any idea what to do?”

Well, the first thing I did, like any good Salesforce Admin would, I googled the heck out of the question to try and find a tool that would suite our needs. In the process, I did come across the suggestion of using Salesforce’s Data Loader or Data Exporter, however both of these tools were lacking the functionality I needed. For example, when you actually run the export, you cannot dictate which objects to pull attachments from. In addition, when you open the (exported) Zip file, you will have a bunch of files with no extensions and no association to the parent ID, which basically renders the file useless.

Having little to no luck finding a tool that got me exactly what I wanted, I reached out to my partner who is well knowledged in Python to see if he could give me hand. As it turns out, Salesforce’s rich REST API documentation allows Python coders to have access to the core of Salesforce and all our lovely data. We worked together, with me providing the specs for the tool and testing and him doing the “hard” part of coding it. And that’s how the Mass Download Attachments (MDA) tool was born.

If you are familiar with Salesforce development, you have probably used APEX or Java. This tool, however, uses Python, which has several advantages:

  • Runs outside of Salesforce – no installations and minimum limitations
  • Advanced data manipulations (Pandas anyone?)
  • Slick and easy to maintain and extend

 

One last note about Python: if you are looking to get started with Python and Salesforce, check out the Simple Salesforce module.

 The MDA has a few important features that I want to call out:

  • Ability to download all Attachments or only all Attachments on the Account’s object
  • Filtering capabilities to exclude certain files based on words in the Attachment name
  • Each file name gets the Attachment ID prepended to the front of the name
  • A CSV download with Parent ID associated to the Attachment file name
  • Each file has the correct extension post download
  • No waiting or count limitations (think SF Data Export tool which only allows an export once a week)
  • There is a logging functionality built in just in case something goes haywire, you will be able to get some context of what might have gone wrong

To top off the list above, we are also planning to release v2 of the tool which will include the following features:

  • Download files with only certain file extensions
  • The ability to skip over files that have already been downloaded (aka delta downloads)
  • Expanding on the Account only object idea by adding additional object specific support for both standard and custom objects

 

To learn how to get the tool and use it, please check out my blog post about the Mass Download Attachments tool here.

About the Author: Yelena is a 1x certified Salesforce Admin. She currently works for a small startup in Silicon Valley as both a project manager and as their sole Salesforce Admin. In her free time, she likes to work on her own blog – sf9to5.com – as well as working on her side art career. She hopes to someday have additional Salesforce certifications and work her way up to becoming a Salesforce Business Architect.

Comments

  1. Yelena Slobard

    Hi Esteve,
    According to the Release Notes for Spring ’17, this is for Lightning Experience only (I’m pretty sure though that it’s a recent update to the release notes). However, I won’t be surprised if the “Notes and Attachments” related list becomes a legacy for Classic in the near future, as Files can already be used in Classic. Here’s a very brief run down of why Files are the way to go: https://admin.salesforce.com/5-reasons-use-files-related-list.