Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are a few ways to download all attached files from all records within a custom object in Salesforce. Here are the steps for one possible method:

  1. Create a new report for the custom object with the following columns: Record ID, File Name, and File ID. Make sure to add a filter to show only records where files are attached.
  2. Run the report and export the results to a CSV file.
  3. Open the CSV file in a spreadsheet program like Microsoft Excel or Google Sheets.
  4. Copy the File ID column and paste it into a new spreadsheet.
  5. In the second column of the new spreadsheet, create a formula that combines the File ID with the Salesforce instance URL and the download URL format. For example, if your Salesforce instance URL is https://example.my.salesforce.com, and the download URL format is /sfc/servlet.shepherd/document/download/, the formula would look like this: = "https://example.my.salesforce.com" & "/sfc/servlet.shepherd/document/download/" & A2
  6. Copy the formula down the column for all File IDs.
  7. Save the new spreadsheet as a CSV file.
  8. Use a program like wget or cURL to download all the attached files from the URLs in the second column of the CSV file. You can use a command like this: wget -i file_urls.csv -P /path/to/download/directory
  9. Wait for all files to finish downloading.

Note: This method may not work for large numbers of files or for files that exceed Salesforce's size limit. Additionally, downloading attachments in bulk may consume significant bandwidth and server resources, so it is recommended to use caution and consult with your Salesforce administrator before attempting this process.