> 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

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](/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**.

![](/files/LYqT3LxorAGrM7ckO3iy)

#### 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.

![](/files/QutBdOGrt2Qh8DUjW0Sb)

#### 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.

![](/files/QutBdOGrt2Qh8DUjW0Sb)

### 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](/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](/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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.sdocs.com/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-document-refresh-updated.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
