> For the complete documentation index, see [llms.txt](https://docs.gridmate.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gridmate.io/advanced-guides/other-components/file-explorer-file-operations.md).

# File Explorer - File Operations

Automate file management from Salesforce Flow with the GM - File Operation action.

## Introduction

**GM File Connect - File Operations** is a GridMate Flow action that lets you manage files from your automations: upload files, attach files to records, and create folders, in **Salesforce Files** or in a cloud storage like **Google Drive**, **SharePoint**, **Box**, **Dropbox**, and **Amazon S3**.

The action is available in Flow Builder as **GM - File Operation**. Each run returns the IDs of the folders, files, or links it created, so later steps of the same Flow can use them. For example, you can create a folder, then create subfolders or upload files inside it.

{% hint style="info" %}
Cloud operations require a configured cloud storage. See [File Explorer - File Connect](https://docs.gridmate.io/advanced-guides/other-components/file-explorer-file-connect.md) to set up Google Drive, Amazon S3, or SharePoint.
{% endhint %}

## Operations

<table data-full-width="true"><thead><tr><th width="240">Operation Type</th><th width="180">Storage</th><th>Description</th></tr></thead><tbody><tr><td>ATTACH_FILE</td><td>Salesforce Files</td><td>Attaches existing Salesforce files to a record.</td></tr><tr><td>UPLOAD_FILE</td><td>Salesforce Files</td><td>Uploads a new file and attaches it to a record. Optionally adds it to a Library and folder.</td></tr><tr><td>CREATE_FOLDER</td><td>Salesforce Library</td><td>Creates a folder in a Salesforce Library. If the folder already exists, the existing folder is returned.</td></tr><tr><td>ATTACH_CLOUD_FILE</td><td>Cloud storage</td><td>Attaches cloud files to a record.</td></tr><tr><td>UPLOAD_CLOUD_FILE</td><td>Cloud storage</td><td>Uploads a file to the cloud storage.</td></tr><tr><td>CREATE_CLOUD_FOLDER</td><td>Cloud storage</td><td>Creates a folder in the cloud storage. Not supported on Amazon S3.</td></tr></tbody></table>

## Inputs

<table data-full-width="true"><thead><tr><th width="240">Input</th><th>Description</th></tr></thead><tbody><tr><td>Operation Type</td><td>Required. One of the operations listed above.</td></tr><tr><td>Record ID</td><td>Target record. Required for ATTACH_FILE, ATTACH_CLOUD_FILE and UPLOAD_FILE.</td></tr><tr><td>File IDs</td><td>Files to attach. Required for ATTACH_FILE and ATTACH_CLOUD_FILE.</td></tr><tr><td>File Metadata</td><td>JSON describing the file to upload (name, target folder). Required for UPLOAD_FILE and UPLOAD_CLOUD_FILE.</td></tr><tr><td>File Content</td><td>Base64 encoded file content. Required for UPLOAD_FILE and UPLOAD_CLOUD_FILE.</td></tr><tr><td>Folder Name</td><td>Name of the folder. Required for CREATE_FOLDER and CREATE_CLOUD_FOLDER.</td></tr><tr><td>Library Name</td><td>Salesforce Library name. Required for CREATE_FOLDER, optional for UPLOAD_FILE.</td></tr><tr><td>Parent Folder ID</td><td>Optional. Folder in which the new folder is created. If empty, the folder is created at the root.</td></tr><tr><td>Cloud Storage Cfg</td><td>Name of the Connect Config record. Required for cloud operations.</td></tr></tbody></table>

## Outputs

<table data-full-width="true"><thead><tr><th width="240">Output</th><th>Description</th></tr></thead><tbody><tr><td>Success</td><td>True when the operation succeeded.</td></tr><tr><td>Message</td><td>Success or error message.</td></tr><tr><td>Created IDs</td><td>IDs of the created folders, files, or links, as a text collection. For Amazon S3 uploads, the object key.</td></tr></tbody></table>

{% hint style="success" %}
Use **Created IDs** to chain operations: create a folder, then pass its ID as **Parent Folder ID** to create subfolders, or as the target folder to upload files into it. Existing Flows keep working unchanged.
{% endhint %}

{% hint style="warning" %}
The action does not stop the Flow on error. Add a **Decision** element after the action to check **Success**, and display **Message** to the user when it is false.
{% endhint %}

## Example: Create Project Folders

In this example, a sales rep creates a project folder in Google Drive for an Opportunity, with **Contracts** and **Invoices** folders inside it, from a single click on the record page.

**The flow:** **GM - Create Project Folders** is a screen flow launched from an Opportunity quick action. It asks for a folder name (the Opportunity name by default), creates the folder in Google Drive, then uses the **Created IDs** output to create the Contracts and Invoices folders inside it. A final screen confirms the folders are ready, or shows the error message if something went wrong.

1. **Get Records:** get the Opportunity using `recordId`.
2. **Screen:** ask for the **Folder Name**.
3. **Action GM - File Operation:** create the project folder.
   * **Operation Type:** `CREATE_CLOUD_FOLDER`
   * **Cloud Storage Cfg:** `gdrive`
   * **Folder Name:** the folder name from the screen
4. **Decision:** check the **Success** output.
5. **Loop** over **Created IDs** and **assign** the value to a `ProjectFolderId` variable.
6. **Action GM - File Operation** (twice): create the Contracts and Invoices folders.
   * **Operation Type:** `CREATE_CLOUD_FOLDER`
   * **Cloud Storage Cfg:** `gdrive`
   * **Folder Name:** `Contracts` / `Invoices`
   * **Parent Folder ID:** `{!ProjectFolderId}`
7. **Screen:** confirm that the folders are ready.

<figure><img src="https://4046919449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MEsSbGy_U_OhthKUpxu%2Fuploads%2FFEGbVM5BNbewGEc1VhBE%2FScreenshot%202026-10-01%20at%204.34.53%E2%80%AFPM.png?alt=media&#x26;token=6b4f8549-0426-4ed1-886b-4224922a5a46" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Created IDs** is a collection. Use a **Loop** element (or any collection element) to read the ID before passing it to the next action.
{% endhint %}

## How to add the action

{% stepper %}
{% step %}

### Add an element

In Flow Builder, click the **+** icon where you want to add the action.
{% endstep %}

{% step %}

### Choose Action

Click **Action**.
{% endstep %}

{% step %}

### Select the action

Search for **GM - File Operation** and select it.
{% endstep %}

{% step %}

### Set the inputs

Enter a **Label**, then set the **Operation Type** and the inputs required for the operation.
{% endstep %}

{% step %}

### Save the flow

Click **Done**, then save and activate the flow.
{% endstep %}
{% endstepper %}

## Next steps

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>File Explorer - File Connect</strong></td><td>Add files from Google Drive, Amazon S3 and SharePoint, and attach folders.</td><td><a href="https://docs.gridmate.io/advanced-guides/other-components/file-explorer-file-connect.md">File Explorer - File Connect</a></td></tr><tr><td><strong>File Explorer</strong></td><td>Browse, preview and manage the files related to a record.</td><td><a href="https://docs.gridmate.io/product-tour/file-explorer.md">File Explorer</a></td></tr><tr><td><strong>GM - File Explorer</strong></td><td>Every property of the component.</td><td><a href="https://docs.gridmate.io/package-reference/components-library/files/gm-file-explorer.md">GM - File Explorer</a></td></tr></tbody></table>

## Demo

Below is a quick demo of File Connect - File Operations, where the user creates a project folder and its subfolders in Google Drive from a single Flow, without leaving the Opportunity record page

{% embed url="<https://youtu.be/9tvJ7i-5v_s>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gridmate.io/advanced-guides/other-components/file-explorer-file-operations.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
