# Adding S-Docs to Customer Portals (Experience Cloud)

S-Docs Lightning Web Components (LWCs) allow Experience Cloud users to generate and manage documents directly from Salesforce record pages. When configured correctly, these components enable community users to generate documents, view previously generated files, and perform post-generation actions without leaving the Experience Cloud site.

This page covers how to configure the **Generate Documents (S-Docs)** and **Documents (S-Docs)** Lightning Web Components for use within an Experience Cloud site.

{% hint style="info" %}
Prerequisite: [An active Experience Cloud site with community users correctly configured, including external sharing settings and page layout assignments.](file:///7962400/experience-cloud-site-setup-for-community-users-with-s-docs.md)
{% endhint %}

## Sharing Settings for S-Docs in Experience Cloud

In addition to base object sharing, S-Docs custom objects must be shared correctly for LWCs to function as expected.

Ensure external sharing settings are configured for the base object used by your S-Docs templates:

### S-Docs Custom Object Sharing

S-Docs uses custom objects to store templates, generated documents, and relationships to base records. The following objects must be shared with community users:

* **SDOC\_\_SDTemplate\_\_c** – S-Docs templates
* **SDOC\_\_SDoc\_\_c** – Generated documents
* **SDOC\_\_SDRelationship\_\_c** – Relationship between documents and base records

If sharing is not configured correctly:

* Templates selected in the LWCs will not appear for end users
* Generated documents may not be visible

***

## Permission Sets for Community Users

S-Docs LWCs rely on Apex classes that must be accessible to Experience Cloud users.

### October ’23 Release and Later

Starting with the **October ’23 release**, S-Docs provides a managed permission set:

* **SDocs LWC Community User**

Assign this permission set directly to community users.

***

## Configuring the S-Docs LWCs

### Step 1: Open Experience Cloud Builder

{% stepper %}
{% step %}
**Open Experience Cloud Builder**

1. Navigate to **Setup → All Sites**
2. Open **Builder** for the Experience Cloud site
3. Select the record detail page where documents should be generated
   {% endstep %}

{% step %}
**Choose Component Placement**

Decide where document generation and document history should appear for users.

Common patterns include:

* A dedicated **“S-Docs” tab** on the record page
* A section within the record detail layout

The layout should align with how users are expected to generate and manage documents.
{% endstep %}

{% step %}
**Add S-Docs Components**

From the component panel:

1. Search for **S-Docs**
2. Drag and drop the following components:
   * **Generate Documents (S-Docs)**
   * **Documents (S-Docs)**
     {% endstep %}
     {% endstepper %}

***

## Configure Generate Documents (S-Docs) LWC

Select the **Generate Documents (S-Docs)** component to access its configuration panel.

### Configuration Options:

* **Title**\
  Header displayed to users (default: *Templates to Generate*)
* **Template IDs or Names**\
  Comma-separated list of S-Docs template IDs or names
* **Notify User**\
  Displays a notification when document generation completes
* **Open Preview**\
  Automatically opens a document preview after generation
* **Record Id**\
  Do not modify (defaults to `{!recordId}`)
* **Object API Name**\
  API name of the base object (e.g., `Account`, `Case`, `Custom_Object__c`)

{% hint style="info" %}
Important: Set the Object API Name before configuring other properties to avoid errors.
{% endhint %}

***

## Configure Documents (S-Docs) LWC

Select the **Documents (S-Docs)** component to configure document visibility and post-generation actions.

### Configuration Options:

* **Title**\
  Header displayed to users (default: *Generated Documents*)
* **Email Template**\
  Record ID of the S-Docs email template to enable emailing documents
* **Automatically Open Email Editor**\
  Opens the email composer automatically after document generation
* **Record Id**\
  Do not modify (defaults to `{!recordId}`)
* **Object API Name**\
  API name of the base object. For example: Account

***

## Preview and Publish

{% stepper %}
{% step %}
**Preview**

1. Preview the Experience Cloud site to verify configuration
   {% endstep %}

{% step %}
**Publish**

1. Publish the site once validation is complete
   {% endstep %}
   {% endstepper %}


---

# 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/quick-start/document-generation/configuring-s-docs-lightning-web-components-in-experience-cloud.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.
