Skip to main content
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! 
7 risposte
  1. 5 lug 2017, 19:33
    I would suggest the following path,

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

    I would suggest the following path,Go to NEW TASK => Export => Object, Type = Attachment =>Now, hit the Next button and it will show you number of records who has an atleast one attachment file attach

    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.
0/9000