How to Export Salesforce Attachments for Specific Object

In this tutorial, we will show how to export Salesforce attachments for a specific object. In our example, we will export attachments for Account object.

Creating Connection

If you haven’t created the Salesforce connection yet, you need to create one first. To create a connection to Salesforce, perform the following steps:

  1. Click +NEW in the top menu.
  2. Click Connection in the menu on the left.
  3. In the opened Select Connector page, select Salesforce. To quickly find it, you can either use the Type to filter box or filter connectors by categories using the All list (for Salesforce, select the CRM category).
  4. The default name of new connection is Untitled. Just click it to rename the connection, for example, to Salesforce1.
  5. From the Environment drop-down list, select the environment type of Salesforce to export data from.
  6. From the Authentication drop-down list select the authentication method for connecting to Salesforce. If you don’t mind storing your Salesforce credentials on our Skyvia server, select User Name & Password. If you prefer not to store your credentials, select OAuth 2.0.

    Connection Editor window

  7. If you have selected User Name & Password, on the previous step, specify your Salesforce account e-mail, password, and security token. Otherwise, if you have selected OAuth 2.0 authentication, click the Sign In with Salesforce button and login via the Salesforce website on the opened page. The result OAuth token will be stored in the connection data. Your Salesforce credentials will not be stored on our website.

    Log In window

  8. Click Create Connection.

    Connection Editor window 2

Creating Package

Now let’s create the corresponding export package. To create a package, perform the following actions:

  1. Click +NEW in the top menu.
  2. In the Integration column, click Export. The export package details page will open.
  3. Rename your package by clicking and editing the package name. The default package name is Untitled. Please note, if you omit this step, the package name will remain Untitled in the list of created packages.
  4. Under Source, in the Connection list, click Select source and select Salesforce connection from the drop-down list.

    Source Connection

  5. Then select Target Type you want to export data to. By default, data are exported to CSV file(s) downloaded manually to a local computer. We use this option in our tutorial. See the screenshot below.

    Target Type

  6. Click the Add new link to open the Task Editor.
  7. From the Object drop-down list, select Attachment.
  8. All the Attachment fields are selected automatically. Clear the checkboxes next to those fields, you don’t want to export.

    Attachment Object

  9. After this, let’s filter the export results by the attachment parent objects. In our case, we want to export attachments with Account parents. For this click +Condition under Filter.
  10. In the first box of the added condition, select Parent.
  11. In the second box, select Type.
  12. In the last box of the condition, select Account. After this, our package will export only attachments with Account parents. You can save the task and the package and run it for execution if this is enough. However, let’s demonstrate a case, when you need to export attachments for a specific account.
  13. Click +Condition under Filter once again.
  14. In the first box of the added condition, select Parent.
  15. In the second box, select Name.
  16. Enter the name of the account into the rightmost box of the condition. In our case it’s ‘Edge Communications’.

    Attachment Object

  17. Click Save to save the task.
  18. Click Create to create the package.
  19. Run the package.
  20. Then, click the Monitor tab of the package details page to see the Run History of the export package. Click the package run you want to download results of.

    Run History

  21. After you do it, the History Details window will appear with detailed information. You can export attachments to your computer by clicking the number of records.

    History Details window

Note that when you export attachments, the result file will be a zip archive containing the CSV file together with an attachment (binary files).

When you export data to a locally downloadable CSV file, the file is available for download for 7 days.