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, orCase
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.
Step 4: Configure Generate Documents (S-Docs)
Select the component and set the core properties.
Recommended starting configuration:
Title:
Templates to GenerateObject API Name: your base object, such as
AccountTemplate 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
Step 6: Configure Documents (S-Docs)
Select Documents (S-Docs) and configure the features your users need.
Recommended starting configuration:
Title:
Generated DocumentsObject 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
Step 8: Test document generation
On the record page:
Find Templates to Generate.
Generate one document.
Confirm the document appears in Generated Documents.
Confirm the file is linked to the record.
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:
Open the S-Docs template record.
Open the template editor.
Go to Document Options.
Under Attachment & File Options, enable Allow Edit.
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.
Recommended Admin Setup
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
Related Guides
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?

