Skip to main content
Skip table of contents

Create Folders in Flow

A common use case is to create a set of folders any time a record (for example an Account) is created.

When creating Folders in a Flow, you must use a collection variable to store the folder names, even if you’re just creating one folder. Use the Apex Action “S-Drive Create Folders Action” to create the folders from the list of folder names.

Sample Flow

Here are the steps for a sample flow to create 3 folders when an Account is created. Some knowledge of Flows is assumed. Refer to Salesforce documentation if you need help with Flows.

  1. Create a new record-triggered flow when an Account is created.

  2. Use an Assignment element to list the names of your folders. Even if you only have one folder, you must put it in an Assignment element using a collection variable.

    1. Select the Assignment element

    2. After giving it a name (ex: Set Folder Names), under Variable, click New Resource. This will be the variable where you list your folders

    3. In the New Resource popup:

      1. Resource Type=variable

      2. Give it an API Name (ex: FolderNames)

      3. Data Type=Text

      4. Check the box for Allow multiple values (collection)

      5. Click Done

    4. Back on the New Assignment window, add your folder names

      1. Variable = FolderNames (the api name of the variable you just created)

      2. Operator = Add

      3. Value = <name you want to give your folder>

      4. Repeat for as many folders as you want to create

      5. Click Done

  3. In the Flow canvas, add an Action element

    1. Filter by Type

    2. click Apex Action

    3. Type S-Drive in the search box and choose S-Drive Create Folders Action

    4. In the New action window:

      1. Give it a Label and API Name (ex: Create My Folders)

      2. Set Input Values:

        1. File Object Name: cg__AccountFile__c

        2. Folder Names: select FolderNames under Collection Variables

        3. Parent Object Name: Account

        4. Parent Record Id: start typing Record, Select Record, Select Record.Id

        5. Relationship Name: Account__c

      3. Click Done

  4. Save and activate the flow

Input Values on S-Drive Create Folders Action

File Object Name: API name of the S-Drive File object. This should be typed in (it won’t be available in the search)

Folder Names: The collection variable where you stored the folder names

Parent Object Name: The API name of the parent object

Check Duplicate folders: If included, set to true to disallow folders with duplicate names.

Parent Folder Id: If included, this can be used to create subfolders. This can be done by creating the top level folders, then looping through the top folders and creating the subfolders by defining the parent folder id for the subfolder.

Parent Record Id: Id of the record the folders are being created on, such as the Account record id. This is not needed for S-Drive Tab (S3Object)

Relationship Name: This is the lookup field to the parent, such as cg__Account__c or Parent__c. It is not needed for S-Drive Tab (S3Object)



JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.