Tutorials

Move Files from HubSpot Forms to your Storage Platform using CloudFiles

16min

In this tutorial, we will explore how you can transfer files submitted through HubSpot forms to your storage platform using the HubSpot - CloudFiles integration. The files will be stored in folders that are automatically created based on form submissions.

What to Expect

By the end of this tutorial, you’ll be able to:

  1. Automatically create a structured folder system in your connected cloud storage (Google Drive, SharePoint, etc.) for each contact.
  2. Associate the created folder with the HubSpot record to allow easy access and management.
  3. Move uploaded files from HubSpot forms to the appropriate cloud storage folders while renaming them.

The GIF below shows the expected output. If you have a basic grasp of these concepts, you can expect to finish the tutorial in under 5 minutes.

Document image


1 - Pre-requisites

Before you start with the set-up, please ensure you have installed CloudFiles and connected it to your cloud storage of choice.

Install CloudFiles in HubSpot

CloudFiles is available on the app marketplace and can be installed using the standard app installation process. Check out Installation guide for CloudFiles HubSpot Integration.

Document image


Connect your storage

Login to your external storage of choice such as Google Drive, SharePoint etc. through the CloudFiles interface. This will give you instant access to your external files within HubSpot. The GIF below shows the steps quickly. Check out Quick start for file connector in HubSpot for more information.

Document image


Connect Automation User for Storage

In addition to installing CloudFiles in HubSpot, you also need to set an automation user for the workflow to work. This is the integration user that will be used by the workflow actions to pass files into the cloud storage.

To connect an automation user, simply head over to app.cloudfiles.io > Settings > Integrations > Google Drive and login through your google account. What is an 'Automation User' and how does it work? this article explains everything you need to know about the automation user, including what it is, why it's useful, and how it operates.

Document image


After connecting the desired storage, we will proceed to create company-based workflow which will be triggered when a new company is registered. Here’s how our final workflow looks like. We will detail these elements in the sections below.

2 - Create a HubSpot Form

I have created a patient registration form in HubSpot to collect essential details such as Identification Proof, Insurance Card Information, and Medical History Information. Along with these, I have included fields for the patient’s first and last name, date of birth, contact details, residential address, and other relevant information. This structured form ensures that all necessary patient data is systematically gathered, making it easier to store, manage, and process within HubSpot.

Document image


3 - Create Contact-based Workflow

Create a new contact-based workflow from scratch and select the trigger to fire when any contact has filled out the Patient Registration form.

Document image


4 - Create Parent Folder using ‘Create Folder’ Action

Create Folder action can be used to create folders in any location on any cloud storage platform from HubSpot flow action. We will use this action to first create the Parent folder in which sub-folders will be created automatically.

To use the “Create Folder” action, simply click on add button and search for ‘Create Folder’ as shown below. Once you add this action, it will ask you to fill in certain parameters.

Document image


This action requires a few parameters. The Library parameter is the desired Cloud storage where you wish to create the folder. Select the desired storage from the drop down field. The Folder name is the name you wish to give your created Folder. We have simply used the Contacts’s first and last names followed by Form Uploads but you can also create a complex text formula variable as well.

The GIF below shows how to populate the Library & Folder name parameter.

Document image


We also need to enter values for Shared Drive ID & Path to Destination. These are -

  • Shared Drive ID - This is important for google drive & sharepoint users only. These cloud storages offer multiple 'drives' where documents can be uploaded.
  • Path to Destination - This specifies the destination folder in which this new folder will be created.

These parameters can be easily copied from CloudFiles app library. Follow these steps -

  1. Find the CloudFiles widget from any HubSpot record, and click on CloudFiles. It will redirect you to your CloudFiles storage.
  2. Under the libraries tab, navigate to folder where you would like to store your files or simply create new folder.
  3. Copy the parameter from the meta data on the right side of the screen.

Check the GIF below for a quick walkthrough of these steps.

Document image


For a detailed description of the Create Folder action, refer to the Create Folder detailed guide. Here’s how our final Create Folder action looks like -

Document image


5- Create Sub-Folders using ‘Create Folder‘ Action

You can create sub-folders using the same ‘Create Folder’ action with just a couple of simple adjustments.

  1. Update the Folder Name:
    • Set this to the name of the sub-folder you want to create.
    • For example, we are creating ‘Identification Proof’, ‘Insurance Card’, and ‘Medical Records’ subfolders inside the parent folder.
  2. Modify the Path to Destination:
    • Ensure this is set to the exact, full path of the parent folder created in the previous step.
    • This ensures that the new sub-folder gets created inside the correct contact’s folder.

Here’s how your second Create Folder action should look like.

Document image


You can choose to have as many sub folders as you want. Simply duplicate the Create Folder action. You can also create sub-sub-folders and even deeper hierarchies using this method.

5 - Show Parent Folder on Company Record using ‘Create Attachment’ Action

The ‘Create Attachment’ action is used to associate the newly created folder with HubSpot records. This step is essential, as it allows you to access and manage the folder's contents directly from the HubSpot record.

  1. Add the Action:
    • Click on the Add button in your workflow.
    • Search for ‘Create Attachment’ and select it, as shown below.
  2. Configure the Required Parameters:
    • Shared Drive ID & Library: Use the same values as in the previous steps.
    • Path to Folder: Enter the exact, full path of the newly created parent folder.
      • You can easily copy this path from the metadata info in the CloudFiles Library, following the same steps used to retrieve the Shared Drive ID.

This ensures that your folder is correctly linked to the HubSpot record, enabling seamless access and management.

Here’s how our final Create Attachment action looks like -

Document image


6 - Move HubSpot Files

The Move HubSpot Files Action is used to move files stored in HubSpot file manager (such as the ones uploaded through a HubSpot form) to an external storage system. This action is useful in scenarios where a HubSpot form is being used to collect files.

To use this action, simply click on add button and search for ‘Move HubSpot Files’ as shown below. Once you add this action, it will ask you to fill in certain parameters. Files, Library, DriveID, Path to Destination, and File name.

Files: This parameter helps specify the file(s) that need to be copied. The value should come from a HubSpot property which stores a publicly accessible HubSpot URL of the file. In this case since I am collecting the Identification Proof , Insurance Card and Medical Records of the patient, I will adding the particular contact property for each of them.

Shared Drive ID & Library: Use the same values as in the previous steps.

Path to Destination: Mention the path as to where the files uploaded through the forms will be saved in cloud storage. In this I have added the path to the parent folder followed by the sub-folder's name so that Medical Records uploaded via the form goes to the Medical Records subfolder created within the parent folder.

File Name: This is the name you wish to give your copied file. In this I want to rename the files uploaded to the contact's first name followed by the Medical Records and similarly for the other documents.

Check the GIF below for a quick walkthrough of these steps.

Document image




Here’s how our Move HubSpot Files action looks like -

Document image




7 - Test the Workflow

To test the workflow, create a new contact or use an existing contact’s email address to fill out the form. Upload the three documents: ID proof, insurance card, and medical history records. Wait for a minute for the workflow to execute. Refresh the page and you should see a folder named after the contact’s first and last name. Inside the parent folder, you will see the subfolders created and they will contain the uploaded files, all accessible from the CloudFiles widget on the right side.

The GIF below provides a visual guide for these steps.

Document image