In this tutorial, we’ll walk through creating one such action called “Bulk Delete”. You’ll set it up so that when users select multiple files or folders in the CloudFiles widget and click the Bulk Delete button, those items will be permanently removed from your connected external storage (e.g., SharePoint, Google Drive) and disappear from the Salesforce record page widget.

By the end of this guide, you’ll have a working Custom List Action that you can configure yourself—ready to streamline file management, reduce clutter, and give your users a one-click way to keep Salesforce clean and organized.

What to Expect

By the end of this tutorial, you will be able to:

  • Automatically generate a main folder with custom sub-folders in your external storage whenever a new Account is created in Salesforce, and access these folders through the CloudFiles widget on the corresponding record.
  • Create and configure a Custom List Action (e.g., Bulk Delete) that appears in the CloudFiles widget when users select one or more files or folders on a Salesforce record page.
  • Use this button to permanently delete selected files or folders from your connected external storage (e.g., SharePoint, Google Drive), directly from Salesforce.

The GIF below illustrates the expected outcome once everything is set up.

Pre-requisites

Before you start with the set-up, please ensure these steps are completed.

Install CloudFiles in Salesforce

CloudFiles is available on the Salesforce AppExchange and can be installed using the standard app installation process. Check out Installation guide to know more.

Connect your Cloud Storage to Salesforce using CloudFiles

All automations in CloudFiles are activated through Salesforce Flow Builder, utilizing account-wide authentication for external storage libraries through a service (admin) user. To connect your service user, access the setup, click on the external storage of choice and log into your account. For detailed steps, refer to the GIF below for a clearer understanding.

Add CloudFiles Widget to Account record page

Add the CloudFiles widget to Account record page in order to view the files and folders within salesforce. Follow the steps below -

  1. Go to any Account record and click “Edit Page” Button.
  2. Lightning builder for this page will open. Insert a new tab and drag and drop the "CloudFiles" widget.
  3. Save and exit the builder. Refresh the Salesforce record page. The widget should now show up.

Refer to the GIF below to get a visual understanding of this step. The inserted widget may show a blank screen but you don't need to worry about it. Move on to the next step.

Automatic folder creation for Accounts

For this tutorial, We require automated folders to be created upon the creation of new Account. To accomplish this, we will create two distinct record-triggered flows using CloudFiles actions. For a comprehensive guide on the process of creating automated folders, please refer to our tutorial at Create Automated Folder Hierarchies for Managing External Files from Salesforce Objects

This is how the flow would look like -

In this section, we’ll walk through how to configure the CloudFiles Widget to add a custom List Action button and link it to the Flow we are going to create in the next steps.

You’ll learn how to:

  • Set up the List Action within the widget configuration.
  • Link the action to your Screen Flow with the appropriate input variables.

Once the configuration is complete, copy the generated Widget Configuration ID and paste it into the CloudFiles widget settings on the Account record page in Salesforce. This step ensures that the correct Resource Action button appears in the widget, allowing users to trigger the delete functionality.

Setting Up Widget Flow Actions in CloudFiles Widget

Follow these steps to configure Resource Actions in the CloudFiles widget -

Step 1: Open Widget Configuration

  1. Navigate to the CloudFiles Document Management App.
  2. Open the "Widget Configuration" page.

Step 2: Locate List Actions Section

Scroll to the bottom of the page, where you'll find the List Actions section. Refer to the image below for a visual understanding -

Step 3: Specify Attributes for Actions

For each List Action, provide the following details:

  • Label – This is the name that will appear on the widget button (e.g., Bulk Delete).
  • Flow URL – The URL of the Flow you want to trigger, including input variables.
  • Flow Type – Choose the type of Flow from the dropdown. For this tutorial, select: Screen Flow

flow/CloudFiles_Mass_Delete_Resources?resources={!resources}&recordId={!recordId}

In this example:

  • {!resources} refers to the files or folders selected by the user in the CloudFiles widget at the time of clicking the defined Custom List Action button.
  • {!recordId} is the Salesforce record (Account) from which the action is being triggered.

Step 4: Save and Link the Widget

  • After entering all configuration values, click Save.
  • Copy the generated Widget Configuration ID.
  • Navigate to the Account record page in Salesforce and paste this ID into the CloudFiles widget configuration panel.

This step enables the List Action button to appear within the widget, allowing users to permanently delete the selected file or folder with just a click.

Flow – Delete Unwanted Resources Using the CloudFiles Custom List Action

In this section, we’ll create a Custom List Action – driven Screen Flow to permanently delete selected files or folders from your connected external storage when triggered by the user. This is especially useful for cleanup operations—for example, removing outdated files from an Account after a project is completed.

We’ll configure a Screen Flow that launches when the user clicks the Custom List Action button after selecting one or more files or folders in the CloudFiles widget.

The Flow will:

  • Permanently remove the selected resources from your connected external storage (e.g., SharePoint, Google Drive).
  • Immediately update the CloudFiles widget so the deleted files or folders no longer appear on the Salesforce record page.
  • Ensure secure deletion while keeping your file structure clutter-free.

Once the Flow is activated, you can proceed to configure the widget and link the Custom List Action. This will allow users to access the Bulk Delete function directly from the CloudFiles widget on the Salesforce record page.

By using this button, users can delete unwanted files or folders in bulk with confirmation, simplifying file management and ensuring that only relevant, up-to-date resources remain accessible.

This is how the final flow looks like -

The details of the flow has been given below -

1 - Configure a Screen Flow

We’ll begin by creating a Screen Flow to handle the logic for bulk deleting files or folders from your connected external storage. Follow the steps below to set up the required input parameters:

  1. Create a new Screen Flow in Salesforce to manage the bulk deletion process.
  2. Add an input variable called recordId to capture the Salesforce record ID (e.g., Account ) from which the action is being triggered via the CloudFiles widget.
  3. Create another input variable called resources variable to get the selected resource from the CloudFiles Widget.

Create Flow Variables

To pass selected resource (file/folder) and the current record ID to the flow, create the following two variables -

  1. resources:
    • Type - Variable
    • Data Type - Apex Defined
    • Apex Class - clds__Resource
    • Allow Multiple Values (Collection) - True
    • Available for Input - True
  2. recordId:
    • Type - Variable
    • Data Type - Text
    • Allow Multiple Values (Collection) - False
    • Available for Input - True

The GIF below provides a visual understanding of this step -

2 - Get Connected Folder

We will use Get Connected Folder Apex action to retrieve the details of the folder connected to the current Account record.

Once you add the action to your Flow, it will prompt you to provide a single input parameter:

  • ParentId – This is the Salesforce Record ID whose connected folder needs to be fetched. In this case, use the {!recordId} variable (which we configured as Available for Input) to pass the current Account's Record ID into the action.

We’ll use the folder information retrieved here in the next step to locate and delete the selected file(s) or folder(s) from the appropriate location in your external storage.

Refer to the GIF below to get a visual understanding of this step.

3 – Collect the Selected Resource ID's to Delete

In this step, the resources variable will already contain details of all the files or folders the user has selected in the CloudFiles widget. To prepare them for deletion, go through each item in this list and pick out just the ID for that file or folder. As you do this, add each ID to another variable, for example ResourceIds. You can gather these IDs using an assignment step called Populate ResourceIds Variable, so by the end you have a single list containing only the IDs of the selected items, ready for the deletion step.

4 – Delete the selected Resources

In this step, we’ll configure the Delete Resource Apex action to remove the selected resources (files & folders) from your connected external storage by passing the required input values.

Delete Resource – Apex Action Configuration:

  1. Library This is the target cloud storage provider where the resource should be deleted. Possible values are sharepoint, google (for Google Drive), onedrive, dropbox, box, cloudfiles (AWS S3). In our case, we can dynamically input this value from the Get Connected Folder action itself using: {!Get_Connected_Folder.library}.
  2. Drive ID This is required for Google Drive and SharePoint libraries. Enter the Drive ID where the selected resources are stored. In this tutorial, since we already have access to the Get Connected Folder action, we can directly use the Drive ID from it: {!Get_Connected_Folder.driveId}
  3. Resource ID We can skip this field because either Resource ID or Resource IDs is required—not both. In our case, we are deleting a list of resources, so we’ll toggle off Resource ID and use Resource IDs instead.
  4. Resource IDs In this field, enter the list of IDs for the files or folders you want to delete from your external storage. Since we have already collected the selected resource IDs into a list variable named ResourceIds in the earlier step, simply pass that variable here. This will ensure that all the selected items are deleted in one go when the flow runs.
  5. Resource Type In our case, this parameter is not required because we are performing a bulk deletion of resources that may include both files and folders in a single operation. For bulk deletion, this field is optional, so you can simply toggle it off.

Once all these fields are filled in correctly, the action will delete the selected items both from the external storage and from the CloudFiles widget on the Salesforce record page.

5 - Save and Activate the flow

Once you’ve finished configuring all elements, save your Flow and then activate it.

After activation, the Flow can be triggered directly from the Custom List Action button in the CloudFiles widget. This button was configured earlier in the CloudFiles Widget Configuration, and its Configuration ID was added to the record page in edit mode.

When users select one or more files or folders and click this button, the Flow will run and permanently delete the selected resources from your connected external storage. The same resources will also be removed from the CloudFiles widget on the Salesforce record page.

Test it in action

To verify that everything is working as expected, follow these steps:

  1. Create a New Account Once the Account is created, the folder structure will be automatically generated by the pre-configured flow responsible for Account folder creation.
  2. Upload Files to the Account Folder Using the CloudFiles widget on the Account record page, upload some test files and folders into the newly created Account folder.
  3. Select and Delete Unwanted Files or Folders When you no longer need certain files or folders, select them in the CloudFiles widget and click the Custom List Action button (Bulk Delete) you configured earlier.
  4. Verify Deletion in the Widget After triggering the action, the deleted resources will no longer appear in the CloudFiles widget on the Account record page—confirming that the deletion was successful.
  5. Confirm Deletion in External Storage Open your connected external storage (e.g., SharePoint, Google Drive) and navigate to the same location where the files were stored. The deleted files or folders should no longer be present.

Flow execution and folder creation may take some time (a few seconds to a minute). If you don't see any changes, try refreshing the CloudFiles widget a couple of times.

Congratulations! You’ve successfully set up a Custom List Action button in the CloudFiles widget, allowing users to easily bulk delete unwanted Account files or folders directly from Salesforce. You’ve also configured the supporting Screen Flow to handle the deletion process—removing selected items from both your connected external storage and the CloudFiles widget—helping keep your Salesforce records clean, organized, and up to date.

This setup streamlines file management, reduces clutter, and ensures that only relevant, current files remain visible to your team—improving efficiency and maintaining a well-structured workspace.