From Drive Connect: Automate the Creation of Google Drive Folders using Salesforce Flow

Editor’s Note: UnofficialSF is pleased to enable commercial creators of Flow extensions like Drive Connect to introduce their products and demonstrate useful use cases. One of our goals is to see a rich tier of commercial solutions in addition to the many free extensions that will continue to be available.

Content provided by Drive Connect

Drive Connect leverages Salesforce flows to automate the creation of files and folders in Google Drive and associate them to the appropriate Salesforce records by storing their url links as content version records. Now users can create intricate folder structures within seconds rather than wasting time in Google Drive, without any code!

Drive Connect was built to work natively in Salesforce. The Automate Drive Flow action has a custom property editor that simplifies the process of building your Drive operations. Some common use cases include:

  • Automating the creation of folders for your accounts upon record creation, then creating folders for the opportunities that will live under the account folder
  • Automation of quotes, orders, or proposals using our merge field based templates on Opportunity Closed Won stage
  • Linking existing account folders to new opportunities upon record creation

Understanding Automate Drive Options

The Automate Drive action allows you to execute a wide variety of functions from Salesforce. Drive Connect requires a record ID to know what is the record initiating the operations, and the most common means of getting this ID is to trigger the flow via a record change. Multiple actions can be built to execute in a specific sequence and hierarchically all from within the custom property editor. Let’s get familiar with what each operation does at a high level.

  • New Drive Folder – The ability to create new folders in Google Drive. You are able to leverage native Salesforce merge fields to create custom folder names (example: you can create a folder with the same name as the record triggering your flow). You are also able to choose the destination of where the folders will live in Google Drive. 
  • New Folder Link – Link an existing folder from either a lookup relationship on the object or from selecting a folder in Google Drive
  • New File Link – Link an existing file from either a lookup relationship on the object or from selecting a file from your Google Drive.
  • Update Drive Folder – Choose a folder to update the name or the location of. This is useful when you want to move an opportunity folder to a different location once the stage has hit Closed Won or Closed Lost.
  • Update Drive File – Choose a file to update the name or location of.
  • New File from Template – This operation will generate a document leveraging Drive Connect’s document generation functionality. You’ll need to choose a template, the file format it will be formatted as (PDF, Google format, or Microsoft equivalent), and the resulting file will be created in Google Drive.

Additionally, you can add child operations to many of the operations listed above without having to add a new flow action. Examples of these are:

  • Save a copy of the file to Salesforce
  • Create a shortcut of the file in a different location
  • Link the file to a parent record via lookup relationships
  • Update a field on the record with either an ID or URL of your choice

Take a look at our help documentation for a full overview of our drive operations.

Use Case Example 1: Automatic Folder Creation for Accounts and Opportunities Based on the Stage field.

Let’s take a look at a common use case where a Salesforce org needs proper naming conventions for their Google Drive folders for Accounts and Opportunities. Everyone is familiar with a cluttered and unorganized drive, thankfully Drive Connect can provide order to how your folders are structured so employees can always find what they are looking for.

First off, you’ll need to install the Drive Connect app. We offer a 14 day free trial so you can set up this entire automation and see it in action before purchasing. 

Alright, let’s move on to our first use case. MarvelPoint Real Estate is using Salesforce to keep track of its sales pipeline. Currently the sales team is manually creating folders for their accounts in a “Clients” folder in a shared drive. When a new opportunity arises, they manually create a folder in Google Drive under that account. Ideally the name of that folder is the same as the Opportunity name.  

In this opportunity folder, 2 folders need to be created. One is for “Legal” and one is for “Pictures”. 

In order to keep track of the right folder in Salesforce, they created a custom URL field on the object. The salesperson needs to remember to copy the Drive Folder URL and paste it into the field, otherwise there would be 0 connection between the two systems.

This needed to be done for every Account that was created in Salesforce and is a tedious task to do manually. MarvelPoint was seeking a better way in organizing their folders and files as the team often forgot to create the folders in the right naming structure, which led to duplicate folders.

This is where Drive Connect and Salesforce Flows come into play. MarvelPoint wants to create a flow that will automate the creation of their folders.

The first thing they do is create a new flow. Since MarvelPoint wants to create a new folder for all new accounts being created, let’s start there.

Drive Connect leverages Record Triggered Flows in Salesforce to run automations.

Let’s choose the Account object to trigger this flow. Since MarvelPoint wants folders to be created for all new accounts created, let’s leave the other options as default.

Next, we will add an action and search for the Automate Drive action. For this flow, we will use the New Drive Folder action. Here we will create a folder using the account name. You can select a field from the Account object or one that is related to the account object via lookup.

Next, we will choose a destination for the folders to live under. MarvelPoint desired to place their account folders under a shared drive called “Clients”.

Linking the folder to the record simply requires you to check the checkbox. We’ll also want to upload files to this folder so checking it as the default record folder will have any new files and folders created from that record default to live under that folder.

An additional request from MarvelPoint was to create an “Opportunities” folder under this account folder to house all of their opportunities. In order to do so, a child operation must be created under the folder we just created where you will use the New Drive Folder operation again. Multiple child folders can be created under a parent folder and child folders can even be created under those child folders if desired.

Here is a demo video showing you how to set up a similar flow we just described.

Alright, so we’ve completed our folder structure for the accounts folder. Once that’s activated, we can go ahead and create another flow for our Opportunities.

Use Case Example 2: Creating and Linking a Child Folder Conditionally

This use case will behave similarly to the last, but the stipulation for this flow is that we only want to create a folder if the stage has hit “Qualification” as Marvelpoint does not want to create folders for unqualified records. We also only want this to run once so we should only allow the flow to run when the record is updated to meet this specific condition.

Now let’s add an Automate Drive action. We will create a New Drive Folder with the name of the opportunity using a merge field. We want the destination of this folder to live under the Account folder’s subfolder called “Opportunities”, so we will choose the option “Folder in Parent Record’s Default Record Folder”. Next we need to choose which lookup field from the opportunity record to be the parent folder, which in this case is the account lookup field. Then we will type in the name of the subfolder, which is “Opportunities”.  

We will also create two child folders, one named “legal” and one named “photos”. 

Use Case Example 3: Creating a Document in a Folder

Finally, let’s create a child operation under the legal folder and place a document in it. The action we will choose is the File from Template option. From here we will choose a template from our templates folder that can be created using Drive Connect’s Document Generation technology. We will create an NDA document as part of this automation. This document will live in the legal folder as every opportunity will need its own NDA. 

That’s all that MarvelPoint needs to get their sales team going so let’s save and activate this flow as well.

Now that our flows are activated, let’s see it in action. First, let’s create a new account. Once the account is created, we’ll see the Google Drive folder with the name of the account linked to the record. 

When clicking on the folder, notice that our “Opportunities” folder lives within it.

If we create an Opportunity record in Salesforce and change the status to “Qualified”, we’ll see files and folders created in Google Drive. 

Clicking on the folder will show you your subfolders and if we click on the legal folder, you’ll see the NDA document in there and ready to be sent off.

Now MarvelPoint’s sales people will never be confused about where to upload their documents when working on their deals. On top of that, MarvelPoint is experiencing significant cost savings since they moved all their files to Google Drive from Salesforce.

Learn more about DriveConnect at, or check out our AppExchange listing! We offer a 14 day free trial of the app, no credit card required.