CloudFiles Template: Create & Attach Record Folder
In this article, we explore the 'Create & Attach Record Folder' flow template that comes packaged with the CloudFiles app. We will quickly cover what this flow template can be used for, and will then talk about how to set it up.
This article is divided in the following sections -
- What can this flow do- In this section we talk about what this flow can be used for. Using the various variables discussed below, this can be highly customized.
- Pre-requisites- A couple things you must ensure have been done before using this flow template
- Creating flow using this template- This is a quick, 1-minute starter step to start using this flow template
- Setting Target Object & Triggers- In this section we make a couple changes in our flow to set trigger & target Salesforce object. The flow works for any standard or custom object.
- Setting destination variables- This talks about all the different settings to set a destination path and name for the created folder. This makes the flow template highly customizable.
- See it in action- We finally turn our flow on and test it out in this section.
Check these sections below for more information.
The 'Create & Attach Record Folder' flow can be triggered on the creation or updation of any standard or custom Salesforce object. Once triggered, the flow creates a folder with a specified name & destination path, in any cloud storage including Google Drive, SharePoint, Dropbox, Box, AWS S3 etc...
Additionally, the flow also associates this folder to the CloudFiles widget on the record. Thus, the Salesforce users can immediately start uploading files and using the folder from inside of Salesforce.
The flow template uses two of CloudFiles' flow actions, namely the create folder and the create attachment actions. The create folder action is used to specify the target folder name and destination to be created. Then the create attachment action takes this new folder and does the association.

There is a lot of customizability possible through the various flow variables used. Check the sections below to see how to setup and start using this flow.
Before using this flow template, make sure you have done the following 2 things -
- Installation & Setup- Make sure you have followed the steps mentioned in the Installation guide. This includes installing the Salesforce app in production or sandbox, connecting CloudFiles account and setting permissions.
- Widget Setup- To ensure the CloudFiles widget is properly set up on one of your Salesforce objects, refer to the instructions provided in the Step 1 of Connect external folder to a record.The connected folder of the flow will be displayed within this widget.
That's it, now lets create a new flow using this template.
You can create a new flow using the 'Create & Attach Record Folder' template. This clones the flow template and replicates all the variables so that you can set them up later. In order to create a new flow using this template, follow the simple steps below -
- Go to Salesforce Setup > Flows
- Locate & click the 'CloudFiles Template: Create & Attach Record Folder' flow. This is created by the package and is not active by default, so make sure to check your list filters if you don't find this.
- Click on Save As in the top right.
- Give your flow a name and save it. The template flow will get cloned.
These steps are shown in the GIF below -
We need to determine a target Salesforce Object on which this flow will trigger and create / set folders on. This target object can be any standard or custom Salesforce object. For the purpose of this article, we have used the Account Object.
We need to update the flow at 2 places to set this target object.
- Update trigger condition- Click on the trigger element and set the Object and Trigger Configuration Settings appropriately. We trigger our flow when an Account object is created.
- Update Create Attachment Action-We also need to tell the 'create attachment' action about the target object. Simply click on the 'Attach to Record' action and update the Salesforce Record Type field to the API name of the object. We use 'Account' for our purpose.
Both of these steps are shown in the GIF below -

In order to configure the target path and name of the folder, we will setup a few variables that are discussed in this section. Check the sub-sections below for more information on these.
The destination library is used by both create & set actions to figure out the destination cloud storage where the folder must be stored. This is a text field and can take one of the following values (in lower case) - sharepoint | google | box | dropbox | cloudfiles | onedrive
To set the library value, edit the library variable on the toolbox manager (top left). This is shown below -

In this step, we will retrieve the folder ID of the parent folder where we want our created folders to get stored. We have chosen a folder in one of our SharePoint sites to act as this destination folder.
The destination folder ID can be retrieved easily using the CloudFiles Content Library from the CloudFiles App Launcher in Salesforce. Follow the steps below -
- Click on App Launcher on top left. Search for the CloudFiles App.
- In the CloudFiles App, select the Content Library Tab
- Go to your cloud storage. You may need to login if you haven't done so before.
- Go to the target folder where you would like to place the created folders in.
- Use the 'View Metadata' option in the tile options dropdown as shown below to open metadata dialog
- A dialog box opens up which shows the folder ID. Copy the ID from here.
These steps are shown in the GIF below -

To set this folder ID in the flow, simply click the 'Create Folder' action, edit the element, and use the parent folder ID input to paste this ID into. This is shown in the screenshot below -

This step is only required for Google Drive & SharePoint users. These storages provide multiple drives in which files can be uploaded. The destination drive ID can be retrieved using the same process as the destination folder ID. The metadata dialog in the above section also shows the drive ID.

To set the destination drive ID in the flow, click on the drive ID variable in Toolbox manager and edit it appropriately. This is shown below -

The name of the newly created folder can be easily setup using any Salesforce record field. Simply click the 'Create Folder' action, edit the element, and use the record selectors in the 'Folder Name' input. We used Account Name as our folder name. This is shown in the GIF below -

That's it, now your flow is setup. You can save, activate and test it out. We do this in the next section.
To test out our final flow, we will save and activate it. We have setup our variables such that the flow will trigger on creation of a new account and will create the folder in a specified folder in SharePoint. The working flow is shown in the GIF below -
