Automate Deal Folder and Subfolder Creation with Selective Folder Sharing in HubSpot
In this tutorial, weβll walk you through the process of automatically creating folders and sub-folders in any external storage system, and how to directly share a link to any specific subfolder from a HubSpot record using the CloudFiles-HubSpot Integration. Weβll use CloudFiles flow actions to automate the creation of these folders and sharing links efficiently.
By the end of this tutorial, you can expect to:
- Set up an automated parent folder for a HubSpot record (e.g., deal) upon its creation.
- Automatically create the desired number of subfolders within the parent folder.
- Attach these folders and subfolders to your HubSpot record.
- Generate a shareable link for any specific subfolder.
The GIF below demonstrates the expected outcome. If you're familiar with these concepts, you should be able to complete 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 deal-based workflow which will be triggered when a new deal is registered. Hereβs how our final workflow looks like. We will detail these elements in the sections below.

ο»Ώ
Create a new deal-based workflow from scratch and select the trigger to fire when a new deal is created as shown in the GIF below.

The "Create Folder" action allows you to create folders in any location on any cloud storage platform directly from a HubSpot workflow. We'll use this action to first create the Parent folder, within which sub-folders will be automatically created.
To use the "Create Folder" action, click the "Add" button and search for "Create Folder". Once added, you'll need to fill in a few required parameters.
- Library: This specifies the cloud storage where you want to create the folder. Select the desired storage from the drop-down field.
- Folder Name: Enter the name of the folder you want to create. You can use the Dealβs name or create a custom formula for the folder name.
The GIF below shows how to populate the Library and Folder Name parameters.

- Shared Drive ID: This is needed for Google Drive and SharePoint users only, as these platforms offer multiple "drives" where documents can be uploaded.
- Path to Destination: This indicates the folder where the new folder will be created.
You can easily get the values for the "Shared Drive ID" and "Path to Destination" from the CloudFiles app library. Hereβs how:
- 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 the folder where you want to store your files or create a new one.
- Copy the parameter values from the metadata section on the right side of the screen.
Check the GIF below for a quick walkthrough of these steps.

For a detailed explanation of the "Create Folder" action, refer to the Create Folder detailed guide. Here's how our final "Create Folder" action looks:

To create sub-folders, weβll use the same "Create Folder" action as before, with just a couple of simple adjustments.
- Change the "Folder Name" to the name of the sub-folder you want to create. For example, weβre creating "Shared Documents" and "Internal Documents" sub-folders inside our Deal folder.
- Update the "Path to Destination" with the exact, full path to the Parent folder created in the previous action.
Hereβs how your second "Create Folder" action should look:

You can create as many sub-folders as needed by duplicating 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 link newly created Shared Documents and Internal Documents sub-folders to HubSpot records. Associating these sub-folders is crucial as it allows you to view and manage the sub-folder contents directly from the HubSpot record.
To use this action, click the "Add" button and search for "Create Attachment," as shown below. After adding this action, youβll be prompted to fill in a few parameters. The "Shared Drive ID" and "Library" parameters will remain the same as mentioned previously.
The "Path to folder" should be the exact, full path of the subfolders youβve created. You can easily copy this from the metadata in the CloudFiles Library, following the same steps as described in the Shared Drive ID section above.
Hereβs how the final "Create Attachment" action should look:

The "Share Attachment Actionο»Ώ" allows you to share attachments through HubSpot workflows. This process is similar to manually creating a sharing link for a file, folder, or dataroom from a HubSpot record.
To use this action, click the "Add" button and search for βShare Attachment.β This action has a single parameter where you specify the attachment to be shared. You can get this attachment from the return value of the "Create Attachment" action of the Shared Documents folder - βNew Attachment ID.β
This is what the final Share Attachment action looks like -

In this step, we will link the URL created in the previous step to a deal property. To do this, first, create a new single-line text property in the HubSpot Deal Settings. Weβll name this property βShareable Link.β
Next, we will use the βEdit Recordβ action to set the shared link to this property. For the "Property to set" field, select βShareable Link.β Under the βShareable Linkβ field, set the value to the βURLβ output from the previous action.
The GIF below demonstrates how to configure the Edit Record action.

Now that everything is set up let's test our workflow. Start by creating a new deal in HubSpot. The workflow may take a few seconds to execute, so you might need to refresh the page if necessary.
Once the workflow completes:
- Go to the CloudFiles widget on the right-hand side. You should be able to see the sub-folders.
- Next, navigate to the properties section and look for the "Shareable Link."
- Copy the link and open it in a new window.
You can now share this link with your contacts, and they will be able to access the documents.
The GIF below demonstrates this process.

ο»Ώ
