Automated Folder Hierarchies for Managing External Files from HubSpot
In this tutorial, we'll guide you on creating automated folders and sub-folders in any external storage directly from any HubSpot record using CloudFiles-HubSpot Integration. We will use CloudFiles flow actions to create these automated folders.
By the end of this tutorial, you can expect to -
- Have an Automated Parent Folder for a HubSpot record (like Company) when it is created
- Have desired numbers and hierarchy of sub-folders within the Parent folder automatically
- You will be able to attach these folders and sub-folders to your record
- You will also be able to access these folders within your HubSpot record within CloudFiles widget
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 10 minutes.
Before you start with the set-up, please ensure you have installed CloudFiles and connected it to your cloud storage of choice.
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.
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.
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.
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.
Create a new company-based workflow from scratch and select the trigger to fire when a new company is created as shown in the GIF below.
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.
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 Company’s name but you can also create a complex text formula variable as well.
The GIF below shows how to populate the Library & Folder name parameter.
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 -
- Find the CloudFiles widget from any HubSpot record, and click on CloudFiles. It will redirect you to your CloudFiles storage.
- Under the libraries tab, navigate to folder where you would like to store your files or simply create new folder.
- 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.
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 -
To create sub-folders, we can simply use the same ‘Create Folder’ action that we used above with a couple of simple tweaks.
- Change the ‘Folder Name’ to reflect the sub-folder you want to create. We are creating ‘Proposals’ and ‘Contracts’ sub-folder inside our Company folder.
- Change the ‘Path to Destination’ to exact and full path to Parent folder name that we created in the previous action. This way, this new folder will get created inside the account’s folder we created previously.
Here’s how your second Create Folder action should look like.
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.
The Create Attachment action is used to associate created folder to HubSpot records. Attaching (or associating) our newly created company folder is important since this will enable us to see and operate on the folder contents right from the HubSpot record.
To use this action, simply click on add button and search for ‘Create Attachment’ as shown below. Once you add this action, it will ask you to fill in certain parameters. “Shared Drive ID” and “Library” parameters will be same as above.
The “Path to folder” will be the exact and full path of the newly created parent folder. You can simply copy from the meta data info in the CloudFiles Library using the same steps as specified in the shared drive ID section above.
Here’s how our final Create Attachment action looks like -
Now that everything is setup, lets test our flow. Simply create a new Company in HubSpot. The workflow may take a few seconds to execute so refresh the page, if required. Navigate to CloudFiles widget on the right, you will be able to see the company folder. Once you browse the company folder, you will be able to see the sub-folders. This is shown in the GIF below -