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

Configure Document Generation On Your Record Page

Add the Generate Documents and Documents components to a Lightning record page, configure common options, and test the full admin setup.

What You'll Build

In this tutorial, you'll add S-Docs Lightning Web Components to a Salesforce Lightning record page.

By the end, you'll have:

  • A Generate Documents (S-Docs) component on a record page

  • A Documents (S-Docs) component below it

  • Optional email, refresh, versioning, and Live Edit features configured

  • A tested record-page workflow for end users

Prerequisites

Before starting, make sure you have:

  • Complete Create Your First Template

  • Permission to edit Lightning record pages

  • A test record for that object

  • Access to Lightning App Builder

  • The target object's API name, such as Account, Opportunity, or Case

If you plan to enable optional features, also confirm:

  • You have an HTML email template ready for email actions

  • Your template supports Live Edit if you want inline editing

  • Your template is configured correctly for the output format you want to generate

Documents generated from these components are saved as Salesforce Files and linked to the record.

1

Step 1: Pick the record page and test record

Choose the object where users will generate documents.

Then open one real record for that object.

Use this record later to test the page after configuration.

2

Step 2: Open Lightning App Builder

  1. Open your test record.

  2. Click on the Settings/Gear Icon

  3. Select Edit Page

Or

  1. Click Setup.

  2. Go to Object Manager.

  3. Open your target object.

  4. Select Lightning Record Pages.

  5. Open the page you want to edit.

  6. Click Edit.

This opens Lightning App Builder.

3

Step 3: Add the Generate Documents component

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

  2. Drag Generate Documents (S-Docs) onto the page.

  3. Place it where users should start the workflow.

A top section or left column usually works best.

4

Step 4: Configure Generate Documents (S-Docs)

Select the component and set the core properties.

Recommended starting configuration:

  • Title: Templates to Generate

  • Object API Name: your base object, such as Account

  • Template Name or Template IDs or Names: choose the templates users should see

  • Notify User: enabled

  • Open Preview: enabled if users should review documents immediately

Use these options only when needed:

  • Allow Users to Select Templates when users should choose from multiple templates

  • Reuse Template for Multiple Documents when one template should generate several documents in one flow

5

Step 5: Add the Documents component

  1. Search for S-Docs again.

  2. Drag Documents (S-Docs) onto the same page.

  3. Place it directly below Generate Documents (S-Docs).

This gives users a clean top-to-bottom workflow:

  1. Generate documents

  2. Review generated files

  3. Email, refresh, edit, or inspect versions

6

Step 6: Configure Documents (S-Docs)

Select Documents (S-Docs) and configure the features your users need.

Recommended starting configuration:

  • Title: Generated Documents

  • Object API Name: the same object used in the Generate Documents component

Optional configuration:

  • Add an Email Template if users should send documents with a predefined message

  • Enable Automatically Open Email Editor if users usually email right after generation

  • Enable Show Refresh if users need to update document data after record changes

  • Enable Show Versions if users need version history on refreshed or edited documents

7

Step 7: Save and activate the page

  1. Click Save.

  2. Click Activate if the page is not already active.

  3. Assign the page as needed for app, record type, or profile.

Then return to your test record.

8

Step 8: Test document generation

On the record page:

  1. Find Templates to Generate.

  2. Generate one document.

  3. Confirm the document appears in Generated Documents.

  4. Confirm the file is linked to the record.

  5. If Open Preview is enabled, confirm the preview opens automatically.

Your base record-page setup is now complete.

Turn On Optional Features

Use the options below to expand the workflow.

Send generated documents by email

Configure an email template in the Documents (S-Docs) component when users send the same type of message often.

You can also enable Automatically Open Email Editor to open email right after generation.

For setup details, see How To: Sending Generated Documents via Email.

Refresh document data

Enable Show Refresh in the Documents (S-Docs) component when users need updated field values in an existing document.

Refresh updates the document content and creates a new version.

For details, see How To: Refresh Document Data Within the Documents.

Show document versions

Enable Show Versions when users need to review earlier document states.

This works best with Refresh Data and Live Edit.

For details, see How To: View Document Versions in the Documents LWC.

Enable Live Edit

Live Edit is controlled on the template.

To enable it:

  1. Open the S-Docs template record.

  2. Open the template editor.

  3. Go to Document Options.

  4. Under Attachment & File Options, enable Allow Edit.

  5. Save the template.

After that, users can edit supported generated files from the Documents (S-Docs) component.

For details, see How To: Editing Generated Documents.

For most internal Lightning record pages, start with this pattern:

  • Generate Documents (S-Docs) at the top

  • Documents (S-Docs) directly below it

  • Notify User enabled

  • Open Preview enabled

  • Show Refresh enabled when record data changes often

  • Show Versions enabled when auditability matters

  • A predefined email template when users send the same document type repeatedly

This keeps generation and post-generation actions in one place.

Common Issues

Templates do not appear in the Generate Documents component

Check these items:

  • The template is built for the same base object as the record page

  • The template name or ID was entered correctly

  • The user has access to the template

  • The component's Object API Name matches the record page object

The document generates, but it does not appear in Generated Documents

Check these items:

  • Both components use the same object configuration

  • The document was created as a Salesforce File

  • The page was saved and activated after configuration

  • The record was refreshed after generation

Refresh or Versions options do not appear

Check these items:

  • Show Refresh is enabled for refresh actions

  • Show Versions is enabled for version history

  • The page was saved and activated after changes

Edit does not appear for a generated document

Check these items:

  • Allow Edit is enabled on the template

  • The generated format supports Live Edit

  • The document came from a template that has Live Edit enabled

DOCX generation does not work as expected

Check the template configuration.

For DOCX output, enable New Microsoft Template Upload on the template.

What You've Built

You now have a Lightning record page where users can:

  • Generate documents from S-Docs templates

  • Review generated files without leaving the record

  • Email documents

  • Refresh document data

  • View document versions

  • Edit supported documents when Live Edit is enabled

Use these pages when you want to expand the setup:

The S-Docs Usage Metrics component is configured on a Home page, not a record page. Use that component separately when you want admin usage reporting.

Last updated

Was this helpful?