Download Binary Files Using a URL or Record Identifier with the Download Attachment Operation

The Salesforce REST Adapter does not facilitate downloading of binary files while performing CRUD operations. To retrieve these files, you must use the Download Attachment operation provided by the Salesforce REST Adapter. This use case describes how to download binary files by using a URL or record identifier.

Download Using the URL

You can obtain the Blob URL by using the existing Salesforce REST Adapter functionality (SOQL/SOSL query or retrieve). You can then use this URL as input and download the binary file content. Follow these steps for more details.

  1. Create a schedule integration
  2. Configure a schedule parameter (for this example, named ParentId).
  3. Drag the Salesforce REST Adapter as an invoke connection into the integration canvas.
  4. On the Action page, select Query Information.
  5. Select SOQL/SOSL Query as the operation type.
  6. Enter a valid SOQL query for binary large objects to retrieve the Id, Name, and Body using ParentId, or Name as a query condition/binding parameter.


    The Edit Operations dialog is shown. The SOQL/SOSL Query radio button is selected. Below this is the Description field. Below this is the field that includes the following query: SELECT id ,Name, Body FROM Attachment WHERE Parentid = '#parentid'. Below this is the Refresh button and Cancel, Go back, and Continue buttons.

    1. If there are multiple attachments on ParentId, then perform the Download Attachment operation for each attachment.
      1. Drag a for-each action into the integration canvas.
      2. Add the Salesforce REST Adapter.


        The Input sources hierarchy is shown. The queryRecords element is selected. On the right is the Configure for each section. The Repeating element field is shown with a value of Attachment. The Current element name field is shown with a value of f1_Attachment.

        The for-each action looks as follows:


        The for each action is shown with a map action, invoke connection, map action, and invoke action.

      3. On the Action page, select Download Attachment.
      4. On the Operations page, select Download Using URL as the operation type.
      5. In the mapper, map the source Body element under Attachment response to the target File URL element.


        The Sources, Mapping canvas, and Target sections are shown. The source element Body is mapped to the target element File URL.

      6. Drag an FTP Adapter into the integration canvas after the map action.
      7. Use the File URL value obtained from the above step to write the file to any FTP location.
  7. Click Business Identifiers Business identifiers icon to specify the tracking variable.
  8. Activate and run the integration.

Download Using the Record Identifier

You can use this operation to download binary file content of a specific record. Follow these steps for more details.

  1. Create a schedule integration
  2. Drag the Salesforce REST Adapter to the integration canvas.
  3. On the Action page, select Download Attachment.
  4. On the Operation page, select Download Using Record Identifier as the operation type.
  5. Select the object that supports the blob field.
  6. Select the blob field associated with the selected business object.
  7. In the mapper, map the source Attachment ID element to the Record Id element.


    The Sources, Mapping canvas, and Target sections are shown. The source element Attachment ID is mapped to the target element Record Id.

  8. Click Business Identifiers Business identifiers icon to specify the tracking variable.
  9. Activate and run the integration.