function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael CovertMichael Covert 

Download all files on an Opportunity

Hello,

Just a little background on my situation, I'm a new Admin/Developer for Salesforce, my company recently started using Salesforce and I'm trying to fulfill all the needs as they come. I have NOT had the time to go through any formal trainning on Salesforce Admin/Dev, I do have .Net programming experience though.

What I need help with is an issue with downloading Files/Attachments from an Opportunity, currently we have users that will upload 5-15 PDF's to an Opportunity and a different user will need to download all the files to process them in another system. Currently I don't see any way to "Download All Files" so the users have been downloading them one at a time and when they have 5-10 different Opportunities like this it becomes a time consuming task.

I have been tasked with finding an efficent way to download all the files/attachments, to accomplish this task I was trying to access the attachments from Apex so I could work with them programmically. Currently I can't even get that to work, everything I try returns zero rows, so this is how I was trying to access those Files/Attachments. Again I am very new, so feel free to suggest better methods to accomplish this task! 

string opportunityId = '0018000000M34fSfdsfS';
List<Attachment> attList = [Select Id, Name FROM Attachment WHERE ParentId =: opportunityId];

I know the Opportunity has Files that I can view but still the query returns zero rows. I also tried some combinations of CombinedAttachments and ContentDocument but still struggling, any help would be greatly appreciated! 
Best Answer chosen by Michael Covert
HARSHIL U PARIKHHARSHIL U PARIKH
I would suggest the following path,

Go to NEW TASK  => Export => Object, Type = Attachment =>

User-added image

Now, hit the Next button and it will show you number of records who has an atleast one attachment file attached.
Then Save and Run.

All Answers

HARSHIL U PARIKHHARSHIL U PARIKH
I would suggest you to use Dataloader.IO website = http://dataloader.io/
You can logIn and just follow through the UI and I am sure you will find a way to export notes and attachments. You can definitely export attachments from here.
Michael CovertMichael Covert
So I was able to use the dataloader.io to see that the Files are not showing up as Attachment Objects but as ContentDocument, which let me to the fact that I need to use ContentDocumentLink to find the Opportunity the ContentDocument is associated with. Kind of a pain to deal with a this point, would you know why they're being associated as ContentDocuments and not Attachments?

And would I be able to access these programmically? To have a user use DataLoader.io and go through that just to download all the files might take just as long as downloading individually.   
HARSHIL U PARIKHHARSHIL U PARIKH
I would suggest the following path,

Go to NEW TASK  => Export => Object, Type = Attachment =>

User-added image

Now, hit the Next button and it will show you number of records who has an atleast one attachment file attached.
Then Save and Run.
This was selected as the best answer
HARSHIL U PARIKHHARSHIL U PARIKH

Hello Michael,

If an above post answer solves your question then please mark  as Best answered since it will help other people as a solution!
Thank You  Michael!

Mustafa JhabuawalaMustafa Jhabuawala

Hi Harshil

I am not able to find this in my dev org - Go to NEW TASK  => Export => Object, Type = Attachment =>

can you please let me know where I can get this?

--
Thank You
Mustafa

Nicolas VUILLAMY 19Nicolas VUILLAMY 19
You can use sfdx-hardis to export any files you want without installing packages or use a paid application :)
 
Instructions are described in this article -> https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd