Flow Actions

Get Folder Contents

Introduction

The Get Folder Contents flow action outputs all the files and folders within a queried external storage folder as a collection of resources. The output collection can then be used in flow elements further.

The image below gives an overview of the input parameters. Detailed description of these parameters are provided in the following section.

Get Folder Contents Flow Action.jpg


What This Action Does

The Get Folder Contents flow action can be combined with various other flow actions or elements to automate processes. For example, you can perform a simple null check on the output collection to determine if the queried folder is empty, or apply more complex logic, such as looping through the collection to segregate files based on naming conventions.

The flow snippet below demonstrates a use case where the Get Folder Contents action retrieves the contents of a template folder with a predefined sub-folder structure. The output collection is then looped over to replicate this structure into another folder, creating each sub-folder one by one with the same name as the current folder in the loop.

Document image


Input Parameters

This action requires the metadata of the target folder to retrieve its contents.

The image below shows the mandatory fields populated for reference.

Screenshot 2024-09-06 at 1.34.21 PM.png


Each parameter is explained in detail below.

Library

The Library parameter is the external storage type you are using. Possible values are sharepoint, google, azure ,onedrive, dropbox, box, or cloudfiles (AWS S3).

This is a mandatory input parameter.

Drive Id

This is important for Google Drive & Sharepoint libraries only. The Drive ID is a unique identifier for a storage location in both SharePoint and Google Drive. In SharePoint, it represents a document library within a site, while in Google Drive, it identifies a user's drive or shared drive.

This is a mandatory input parameter.

Resource Id

This is the folder Id of the target folder whose contents are to be retrieved.

This is a mandatory input parameter.

You can get these three parameters by viewing metadata details for a folder in the “Content Library” tab of CloudFiles app in Salesforce or can be fetched through other flow actions like Get Connected Folder.

Resource Path

This parameter is not in use currently and can be toggled off.

Resource Name

This parameter is not in use currently and can be toggled off.

Type

This parameter is not in use currently and and can be toggled off.

Output Parameters

The action returns all the contents of the input folder as a collection of resources.

See It In Action

In the GIF below, it is shown how the flow action retrieves the contents from a folder.

Document image