# S-Docs LWC Reference

Use this page when you need exact setup details for S-Docs Lightning Web Components.

If you need a walkthrough first, start with [Add S-Docs Lightning Components to a Record Page (Tutorial)](broken://spaces/WKNnJmhJBQwhdk5WBFsi/pages/XCiYC5lAUjTADjNHGYJO).

If you need task-based instructions, use [S-Docs LWC How-To Guides](https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/blob/main/automation-and-document-lifecycle/workflows/s-docs-lwc-how-to-guides/README.md).

{% hint style="info" %}
This reference focuses on record-page configuration for **Generate Documents (S-Docs)** and **Documents (S-Docs)**.

The **S-Docs Usage Metrics** component is configured on a Lightning Home page, not a record page. See [Configure the S-Docs Usage Metrics LWC on Home Page](https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/blob/main/administration/landing-page-for-admin/install-configure/configure-the-s-docs-usage-metrics-lwc-on-home-page.md).
{% endhint %}

***

### Component roles

#### Generate Documents (S-Docs)

Use this component to show templates and start document generation.

It belongs at the start of the workflow.

#### Documents (S-Docs)

Use this component to work with generated files.

It supports email, refresh, version history, and Live Edit workflows.

If your org uses S-Sign, users can also send generated files for e-signature from this workflow.

***

### Shared setup rules

These rules apply to both record-page components:

* Add both components in **Lightning App Builder**.
* Use the same **Object API Name** on both components.
* Set **Object API Name** before the rest of the properties.
* Keep **Record Id** at its default value if the property is shown.
* Place **Documents (S-Docs)** near **Generate Documents (S-Docs)**.
* Use Salesforce component visibility rules when different records need different LWC setups.

{% hint style="info" %}
Documents generated from these components are saved as **Salesforce Files** and linked to the record.
{% endhint %}

***

### Where to configure these components

Configure both LWCs in **Lightning App Builder** on a Salesforce record page.

Common ways to open the page:

* Open a record and click **Edit Page**
* Go to **Setup** → **Object Manager** → your object → **Lightning Record Pages**

In the component panel, search for **S-Docs**.

Then add:

* **Generate Documents (S-Docs)**
* **Documents (S-Docs)**

***

### Component settings

Use these child pages for exact component options:

* [Generate Documents (S-Docs) Settings](/developer-hub/document-generation-workflows/apex-and-programmatic-automation/s-docs-lwc-reference/generate-documents-s-docs-settings.md)
* [Documents (S-Docs) Settings](/developer-hub/document-generation-workflows/apex-and-programmatic-automation/s-docs-lwc-reference/documents-s-docs-settings.md)

{% hint style="info" %}
Use the Generate Documents settings page for template selection and generation behavior.

Use the Documents settings page for email, refresh, and version history behavior.
{% endhint %}

***

### Recommended placement patterns

Use a layout that keeps generation and post-generation actions close together.

Common patterns:

* Put **Generate Documents (S-Docs)** above **Documents (S-Docs)**
* Place both components in the same column or region
* Use a dedicated tab when the record page has many components
* Use component visibility rules when different users or record types need different templates

{% hint style="info" %}
If you need different predefined email templates, create multiple **Documents (S-Docs)** components and control visibility with Salesforce rules.
{% endhint %}

***

### Feature dependencies and limits

#### Emailing documents

Users can send one or more generated files from **Documents (S-Docs)**.

Keep these rules in mind:

* A value is required in the **To** field before send.
* Subject, recipients, and body can come from the email template.
* Only one email template can be assigned to the component.
  * Multiple components can be created and made conditionally visible with Salesforce.

For steps, see [Sending Generated Documents via Email (S-Docs LWC)](https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/blob/main/automation-and-document-lifecycle/workflows/sending-generated-documents-via-email-s-docs-lwc.md).

#### Sending for e-signature

If your org uses S-Sign, users can start signature workflows from generated files in **Documents (S-Docs)**.

This action depends on your S-Sign setup and availability in the org.

#### Refresh Data

Use **Refresh** when the record changed and users need an updated file without rebuilding the workflow.

Keep these limits in mind:

* Refresh creates a new version.
* Refresh will overwrite any edits previously made.
* Refresh does not support **Runtime Prompts**.
* Refresh does not support **Job Splitters**.

For steps, see [Refresh Document Data Within the Documents (S-Docs LWC)](https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/blob/main/automation-and-document-lifecycle/workflows/refresh-document-data-within-the-documents-s-docs-lwc.md).

#### Version history

Use **Show Versions** when refreshes or edits must remain traceable.

Keep these limits in mind:

* Version history is visible only when **Show Versions** is enabled.
* Versioning does not apply to HTML email templates.
* Runtime Prompts and Job Splitters are not compatible with this workflow.

For steps, see [View Document Versions in the Documents LWC](https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/blob/main/automation-and-document-lifecycle/workflows/view-document-versions-in-the-documents-lwc.md).

#### Live Edit

Live Edit is enabled on the template, not on the component.

To expose **Edit** in **Documents (S-Docs)**, the template must have **Allow Edit** enabled.

**Supported formats:**

* PDF
* PDF-Upload

**Limits:**

* PDF-Upload templates allow editing merged field data only.
* Editing cannot be limited to specific sections.

For steps, see [Editing Generated Documents (Live Edit)](https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/blob/main/automation-and-document-lifecycle/workflows/editing-generated-documents-live-edit.md).

***

### Output and storage notes

* Generated documents are saved as Salesforce Files.
* `SDOC__File_ID__c` stores the generated file's Salesforce ContentDocument ID.
* You can use that ID to locate the file in tools like Salesforce Inspector or Developer Console.
* For DOCX generation, enable **New Microsoft Template Upload** on the template.

***

### Recommended baseline configuration

For most internal Lightning record pages, start here:

* **Generate Documents (S-Docs)** above **Documents (S-Docs)**
* **Show Refresh** enabled when record data changes after generation
* **Show Versions** enabled when auditability matters
* One predefined **Email Template** when users send the same document type often

***

### Save, activate, and validate

After configuration:

1. Click **Save**
2. Click **Activate** if the page is not active
3. Assign the page by app, record type, or profile if needed

Then test with a real record that matches the template object.

Use this quick check:

* The template list appears
* A document generates successfully
* The file appears in **Documents (S-Docs)**
* The file is linked to the record as a Salesforce File
* Preview opens if **Open Preview** is enabled
* Email, Refresh, Versions, or Edit appear only when their requirements are met

***

### Troubleshooting checklist

<details>

<summary>Templates do not appear</summary>

Check these items:

* The template uses the same base object as the record page.
* The template name or ID is correct.
* The user can access the template.
* **Object API Name** matches the page object.

</details>

<details>

<summary>The generated file does not appear in Documents (S-Docs)</summary>

Check these items:

* Both components use the same object.
* The page was saved and activated.
* The record was refreshed after generation.
* The file was created successfully and linked to the record.

</details>

<details>

<summary>Refresh or Versions is missing</summary>

Check these items:

* **Show Refresh** is enabled.
* **Show Versions** is enabled.
* The page was saved and activated after the change.

</details>

<details>

<summary>Edit is missing</summary>

Check these items:

* **Allow Edit** is enabled on the template.
* The generated format supports Live Edit.
* The file came from a template with Live Edit enabled.

</details>

<details>

<summary>Email actions do not behave as expected</summary>

Check these items:

* The **Email Template** is valid for the object.
* Only one email template is assigned to the component.
* The **To** field has a value before send.
* **Automatically Open Email Editor** is enabled if email should open right after generation.

</details>

<details>

<summary>DOCX generation does not work</summary>

Check the template configuration.

Enable **New Microsoft Template Upload** on the template.

</details>

***

### Related pages

* [Add S-Docs Lightning Components to a Record Page (Tutorial)](broken://spaces/WKNnJmhJBQwhdk5WBFsi/pages/XCiYC5lAUjTADjNHGYJO)
* [S-Docs LWC How-To Guides](https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/blob/main/automation-and-document-lifecycle/workflows/s-docs-lwc-how-to-guides/README.md)
* [Configuring S-Docs Lightning Web Components in Experience Cloud](broken://spaces/WKNnJmhJBQwhdk5WBFsi/pages/iBfBHJQCeShUKYBee1ey)
* [Configure the S-Docs Usage Metrics LWC on Home Page](https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/blob/main/administration/landing-page-for-admin/install-configure/configure-the-s-docs-usage-metrics-lwc-on-home-page.md)


---

# 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/developer-hub/document-generation-workflows/apex-and-programmatic-automation/s-docs-lwc-reference.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.
