# How To: Refresh Document Data Within the Documents

The **Refresh Data** feature in the Documents (S-Docs) Lightning Web Component allows users to **update the data inside an existing document without fully going through the regeneration of the document**.

Instead of creating a brand-new document from scratch, Refresh Data **re-syncs the document’s merge fields with the latest Salesforce record data** and saves the update as a **new version** of the same document.

This ensures documents remain accurate while preserving their structure, formatting, and history.

***

### How Refresh Data Works

When a document is refreshed:

* The document template is **not re-selected or re-generated**
* The existing document is **updated with the latest Salesforce data**
* A **new version** of the document is created
* Previous versions remain available for reference (if versioning is enabled)

This allows users to quickly update documents after record changes without repeating the full document generation process.

***

### Enabling Refresh Data

To allow users to refresh documents:

1. Open **Lightning App Builder**
2. Edit the desired record page
3. Select the **Documents (S-Docs)** component
4. Enable **Show Refresh**
5. Save and activate the page

Once enabled, the **Refresh** option appears next to generated documents in the Documents LWC.

***

### Using Refresh Data to Update a Document

**To refresh document data:**

1. Navigate to the record page.
2. Locate the **Documents (S-Docs)** component.
3. Select the generated document you want to update.
4. Click **Refresh**.
5. The document is updated with the latest Salesforce data.

The refreshed document is saved as a **new version** of the existing document, while previous versions remain available (if version history is enabled).

***

### What Happens After Refreshing

After the refresh completes:

* The document reflects the most current record data
* The document’s layout and formatting remain unchanged
* The refreshed version becomes the active version
* Earlier versions can still be accessed from the **Versions** menu (if enabled)

This allows users to quickly update documents without regenerating them or leaving the record page.

***

### When to Use Refresh Data

Refresh Data is ideal when:

* Record field values change after document creation
* Pricing, dates, or status fields are updated
* Users need the latest data before emailing or sending for e-Signature
* Regenerating the document entirely is unnecessary

{% hint style="info" %}
**Considerations**

* Refresh Data **does not fully regenerate** the document
* The original template and formatting remain unchanged
* Refreshing creates a **new version**, not a separate file
* Version history is visible only if **Show Versions** is enabled
* Runtime Prompts and Job Splitters are not supported
  {% endhint %}


---

# Agent Instructions: 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:

```
GET https://help.sdocs.com/sdocs/automation-and-document-lifecycle/workflows/refresh-document-data-within-the-documents-s-docs-lwc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
