For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

Refresh updates the same SDoc record.

S-Docs saves the update as a new version.

Start here if you are newer to Flow

New to Flow? Start with Getting Started: Automate Document Generation.

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.

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.

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.

Troubleshooting and common errors

The Flow faults when the action runs
  • 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.

The wrong document was refreshed
  • 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.

A new file was expected, but the same document was updated
  • 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.

Advanced configurations and reference

  • Field-level action details: Flow Reference

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