> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-document-refresh-updated.md).

# Refresh Generated Documents with Flow

Refresh an existing SDoc from Flow so it pulls the latest Salesforce data and saves the update as a new version.

Use this guide when you want a **Flow** to update an existing generated S-Doc.

Use this pattern when the source record changed and you want a new version, not a new file.

{% hint style="info" %}
Refresh updates the same **SDoc** record.

S-Docs saves the update as a new version.
{% endhint %}

{% hint style="warning" %}
Refresh does not fully regenerate the document.

**Runtime Prompts** and **Job Splitters** are not supported.
{% endhint %}

#### Start here if you are newer to Flow

New to Flow? Start with [Getting Started: Automate Document Generation](https://help.sdocs.com/quick-start/document-generation/getting-started-automate-document-generation.md).

### Prerequisites

* A **Flow** that can run S-Docs actions
* An existing generated **SDoc** record to refresh
* Access to the target **SDoc** record
* A way to store or retrieve the generated **SDoc** ID before the refresh step runs

### Step-by-step tutorial

#### Step 1: Add the refresh action

Open **Flow Builder**.

Add an **Action** element.

Choose **Refresh Document Data**.

Enter a **Label** and **API Name**.

![](https://1548664070-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWKNnJmhJBQwhdk5WBFsi%2Fuploads%2Fgit-blob-0368e38991a8e4127db29e7af5a977152fd82539%2FScreenshot%202026-04-30%20145928.png?alt=media)

#### Step 2: Map the SDoc ID

Map the generated **SDoc** ID into the required action input.

If the document was generated earlier in the Flow, use the ID returned by that step.

If the document already exists, use a stored value or a prior **Get Records** step.

![](https://1548664070-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWKNnJmhJBQwhdk5WBFsi%2Fuploads%2Fgit-blob-9abf4503d04f357f795e9a795f3a11f3e63efab9%2FScreenshot%202026-04-30%20145756.png?alt=media)

#### Step 3: Save, activate, and test

Click **Done**. Then save and activate the **Flow**.

Run the **Flow** and confirm it refreshes the expected **SDoc**.

Confirm the document shows current Salesforce data.

Confirm S-Docs creates a new version of the same document.

![](https://1548664070-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWKNnJmhJBQwhdk5WBFsi%2Fuploads%2Fgit-blob-9abf4503d04f357f795e9a795f3a11f3e63efab9%2FScreenshot%202026-04-30%20145756.png?alt=media)

### Troubleshooting and common errors

<details>

<summary><strong>The Flow faults when the action runs</strong></summary>

* **Symptom:** The refresh action errors or the **Flow** goes down the **Fault** path.
* **Cause:** The mapped `sdocId` value is blank, invalid, or does not point to a generated **SDoc** record.
* **Fix:** Check the resource you mapped into the action. Confirm it stores a valid generated **SDoc** `Id`. If needed, add a **Fault** path so the Flow surfaces the exact error during testing.

</details>

<details>

<summary><strong>The wrong document was refreshed</strong></summary>

* **Symptom:** The action finishes, but it updates a different document than expected.
* **Cause:** The **Flow** mapped the wrong **SDoc** record ID into the action.
* **Fix:** Review the step that stores the document ID. Confirm the correct **SDoc** `Id` is passed into the action before refresh runs.

</details>

<details>

<summary><strong>A new file was expected, but the same document was updated</strong></summary>

* **Symptom:** The original document changes instead of a separate file being created.
* **Cause:** Refresh updates the existing **SDoc** by design.
* **Fix:** Use a document generation action when you need a separate output file.

</details>

### Advanced configurations and reference

* Field-level action details: [Flow Reference](https://help.sdocs.com/developer-hub/document-workflows/flow-reference.md#refresh-document-data)
* Action API name: `SDOC__RefreshDocumentDataInvocable`

#### Required action input

* **SDoc ID** — Required. Pass the generated **SDoc** record ID you want to refresh.

#### Output behavior

* The action updates the existing generated document with current Salesforce data.
* The action does not re-select the template.
* The action does not create a separate file.
* The original layout and formatting remain unchanged.

#### Version visibility

To let users view earlier versions on the record page, enable **Show Versions** in the **Documents (S-Docs)** component. For that setup, see [View Document Versions in the Documents LWC](https://help.sdocs.com/sdocs/automation-and-document-lifecycle/workflows/view-document-versions-in-the-documents-lwc.md).


---

# 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://help.sdocs.com/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-document-refresh-updated.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.
