---
title: "Automating File Upload - Appiphony"
url: "https://appiphony.com/docs/drive-connect/features/automation/uploading-files"
description: "Looking to use Salesforce Flow to upload files to Google Drive? We've got you covered! Learn how with Record-Triggered or Scheduled Flows."
---

# Automating File Upload

Drive Connect can automatically upload Salesforce Files to Google Drive. Once uploaded, files can be automatically linked to the record they were originally attached to and show up in the Drive Links component. Salesforce Files can also be automatically deleted from Salesforce once they are uploaded to Google Drive, saving you on pricey Salesforce storage.

There are two ways to upload files using Flow:

- **Record-Trigger Flow -** Use this when you want a file immediately uploaded to Google Drive upon upload to Salesforce.
- **Scheduled Flow -** Use this when you have existing files in Salesforce you want to upload to Google Drive or you want to periodically move files for archival purposes.

> Please note that uploading files using Scheduled Flows requires the Mass Actions add-on. Please [contact sales](https://appiphony.com/contact-sales/) for more information.

### Uploading Files to Google Drive with Record-Triggered Flows via Custom File Object

With Drive Connect installed, a custom file object for use with the Automatic File Upload feature will be added. When using the File Object, you will be able to trigger the flow from any object record, and the act of uploading files into Salesforce will be the trigger.

1. 1. Go to **Salesforce** **Setup**.
   2. Search for **Flows**.
   3. Click on **New Flow**.
   4. Select **Record Trigger Flow** and then click **Create**.
   5. On **Configure Start**, select the custom packaged object **driveconnect__File__c** object. You will only be able to trigger the flow when **A record is created**.
   6. Below the starting node select the **Add Element** node and then select **Action**. This will auto-display the Action section to the right.
   7. In the Search Actions panel that appears at right, search for and select the **Automate Drive** action **(apex-driveconnect__AutomateDrive)**.
   8. Complete the configuration of the operation. Below is a list of some of the available options:  
      - **Publish Results Event—** If this is toggled on and the Link file to record is enabled, then when a file is uploaded to Google Drive, the Drive Links component will automatically refresh to show all of the uploaded files.
      - **File Name —** By default, is is set to Existing File Name which is the name of the file in Salesforce once the upload process begins. However this can be changed to any of the following options:
        - Existing File Name - Created Date
        - Custom Name - This is an input field where you can provide static text or merge fields to hard set the name of the Salesforce file once the upload process begins.
      - **Destination –** By default, it is set to Default Record Folder, however, this can be changed to any of the following destinations:
        - Default Object Folder
        - Folder in Default Record Folder
        - Linked Folder
        - My Drive
        - Folder from Drive…
      - **Fallback Destination —** By default, it is set to None. However, if you select Upload to Folder from Drive the Google picker will pop up and you can select a folder location. This selected folder location is where files will upload should the previously selected Destination not exist for a record when the scheduled job runs instead of being skipped.
      - **Link file to record—** If enabled, the uploaded Salesforce files will appear on the Drive Links component once the flow has been completed. Complete the configuration of the action and click on **Done**.
      - **Delete Salesforce File—** If enabled, the uploaded Salesforce files will be deleted from the Salesforce File component once the flow has been completed.
   9. Click on **Save**.
   10. Click on **Activate**.
   11. Now that your flow is set up, you can go to an object record and upload a file to Salesforce. Your files will appear in the designated Google Drive location.

> **Please Note:** Due to Salesforce heap size limitations, only files up to ~11MB can be uploaded.

### Uploading Files to Google Drive with Record-Triggered Flows via an Object

When using the automatic file upload feature for a desired object you will be able to trigger the flow from only a record on that object, however all existing files for that object record will be uploaded on flow trigger.

1. Go to **Salesforce** **Setup**.
2. Search for **Flows**.
3. Click on **New Flow**.
4. Select **Record Trigger Flow** and then click **Create**.
5. On Configure Start, select a **desired Object**. You will only be able to trigger the flow when either **A record is created** or **A record is updated**.
6. Below the starting node select the **Add Element** node and then select **Action**. This will auto-display the Action section to the right.
7. In the Search Actions panel that appears at right, search for and select the **Automate Drive** action **(apex-driveconnect__AutomateDrive)**.
8. Select the Operation **Upload to Drive** from the operation picklist.  
   > **Please Note:** The user must have the ability to delete files in Salesforce in order for all the files to get deleted. Giving users the **Delete Files** permission is recommended.
9. If the packaged custom object **driveconnect__File__c** is set, you will only see the operation **Upload to Drive**.
10. Complete the configuration of the operation. Below is a list of some of the available options:  
    - **Publish Results Event—** If this is toggled on and the Link file to record is enabled, then when a file is uploaded to Google Drive, the Drive Links component will automatically refresh to show all of the uploaded files.
    - **File Name —** By default, is is set to Existing File Name which is the name of the file in Salesforce once the upload process begins. However this can be changed to any of the following options:
      - Existing File Name - Created Date
      - Custom Name - This is an input field where you can provide static text or merge fields to hard set the name of the Salesforce file once the upload process begins.
    - **Destination –** By default, it is set to Default Record Folder, however, this can be changed to any of the following destinations:
      - Default Object Folder
      - Folder in Default Record Folder
      - Linked Folder
      - My Drive
      - Folder from Drive…
    - **Fallback Destination —** By default, it is set to None. However, if you select Upload to Folder from Drive the Google picker will pop up and you can select a folder location. This selected folder location is where files will upload should the previously selected Destination not exist for a record when the scheduled job runs instead of being skipped.
    - **Link file to record—** If enabled, the uploaded Salesforce files will appear on the Drive Links component once the flow has been completed. Complete the configuration of the action and click on **Done**.
    - **Delete Salesforce File—** If enabled, the uploaded Salesforce files will be deleted from the Salesforce File component once the flow has been completed.
11. Click on **Save**.
12. Click on **Activate**.
13. Now navigate to your desired object record.
14. Verify the files that will upload to Google Drive.
15. Trigger your automation to get your Salesforce files to upload to Google Drive.

> **Please Note:** Due to heap size limitations only files that are at most ~11MBs in size will upload.

### Upload Files to Drive with Schedule-Triggered Flows

Leverage Scheduled Flows when you have existing files in Salesforce you want to upload to Google Drive or you want to periodically move files for archival purposes. When using the scheduled flow action, all files under the same record will go to the same destination.

> **Please Note:** Uploading files using Scheduled Flows requires the Mass Actions add-on. Please [contact sales](https://appiphony.com/contact-sales/) for more information.

1. Navigate to **Salesforce Setup**.
2. Search for **Flows**.
3. Click on **New Flow**.
4. Select **Scheduled Automations**.
5. Select **Schedule-Triggered Flow****.**
6. Under **Start Schedule-Triggered Flow**, set the schedule and select the **Choose Object (Optional)** and set the object to the object the files are associated with.  
   > **Please Note:** There is no pointer to the original object for each attachment, so all files would need to be routed to a single folder as opposed to being directed to individual record folders.
7. When the **Add Element panel** appears, select **Action**.
8. In the **Search Actions panel** that appears at right, search for and select the **Automate Drive action (apex-driveconnect__automateDrive).**
9. Select the Operation **Upload to Drive.**  
   > **Please Note:** Uploading files using Scheduled Flows requires the Mass Actions add-on. Please [contact sales](https://appiphony.com/contact-sales/) for more information.
10. Complete the configuration of the action and click **Done**. Below is a list of some of the available options:  
    - **Publish Results Event —** If this is toggled on and the Link file to record is enabled, then when a file is uploaded to Google Drive, the Drive Links component will automatically refresh to show all of the uploaded files.
    - **File Name —** By default, it is set to **Existing File Name** which is the name of the file in Salesforce once the upload process begins. However, this can be changed to Created Date as well.
    - **Destination –** By default, it is set to **Default Object Folder.** However, this can be changed to any of the following destinations:
      - Default Record Folder
      - Folder in Default Record Folder
      - Linked Folder
      - Parent Record’s Default Record Folder
      - Folder in Parent Record’s Default Record Folder
      - Parent Record’s Linked Folder
      - My Drive
      - Folder from Drive…
    - **Fallback Destination —** By default, it is set to **None.** However, if you select Upload to Folder from Drive the Google picker will pop up and you can select a folder location. This selected folder location is where files will upload should the previously selected Destination not exist for a record when the scheduled job runs instead of being skipped.
    - **Link file to record —** If this is enabled, the uploaded Salesforce files will appear on the Drive Links component once the flow has been completed.
    - **Delete Salesforce File —** If this is enabled, the uploaded Salesforce files will be deleted from the Salesforce File component once the flow has been completed.
    - **Child Operation: New Drive Shortcut —** If this is added, the uploaded Salesforce files will have a shortcut created in Google Drive to any of the above Destination options you select.
11. Click **Save.**
12. Enter the required fields for **Flow Label** and **Flow API Name**, then click **Save.**
13. Click **Activate.**
14. Now that your flow is set up, you can go to **Scheduled Jobs** and see that the job has been scheduled to run.

> ***Please Note:*** *Due to Salesforce heap size limitations, only files up to ~11MB can be uploaded.*
