Getting Started: Automate Emails
Extend a Salesforce Screen Flow to email a generated S-Docs document.
What You'll Learn
Extend a Screen Flow to email a generated S-Docs file
Add the S-Docs Send Email action after document generation
Pass the generated
SDoc IDinto the email action as an attachmentReuse an S-Docs email template for the message body
Test the full generate-and-email flow from a real record
What You'll Build
In this tutorial, you will update the Opportunity flow from Generate Documents Using Flows.
By the end, you will have:
One Screen Flow that generates a document
One S-Docs email action after generation
One outbound email that uses an S-Docs email template
One generated PDF attached to the sent email
Estimated time: 10 minutes
Prerequisites
Before you start, make sure you have:
Complete Create Your First Email Template
The email action needs a valid recipient source. Use your S-Docs email template defaults, or map a recipient value in the flow action.
Step 2: Add the Send Email action
Ensure you are choosing the correct Send Email action. You will see the S-Docs namespace listed in the invocable action.
Insert the email step after document generation.
Click the + between Generate Document and Document Created.
Choose Action.
Search for
Send Email.Select the S-Docs send email action.
Set Label to
Send Email.Set API Name to
Send_Email.
What you just did:
Added the second S-Docs action to the flow
Placed email sending after the file is created
Step 3: Configure the core email inputs
Map the action to the same record, template, and generated file.
In Set Input Values:
Set Base Record ID to
{!recordId}.Enter the exact value for S-Docs Email Template Name or ID.
Set Attachments to the
SDoc IDoutput from Generate Document.Click Done.
Use the exact S-Docs email template name or record ID.
What you just did:
Connected the email action to the current
OpportunityTold the action which S-Docs email template to use
Attached the file created by the previous step
Step 4: Add recipient overrides only when needed
Your email template may already control recipients, subject, or body.
Only map extra values in the flow when you need to override that behavior.
Common optional inputs include:
Recipient Email Address when the template does not set a default recipient
CC or BCC when your process requires extra recipients
Subject Line when the flow must override the template default
Keep the first version simple.
Test the base flow before you add overrides.
Step 7: Test the full flow from an Opportunity record
Run the flow from a real record.
Open a test
Opportunity.Launch the flow from the record page.
Let the flow complete.
Verify the generated file appears on the record.
Verify the email arrives.
Open the email and confirm the generated PDF is attached.
Check these results:
The flow completes without an error
The correct email template is used
The generated file is linked to the same
OpportunityThe email includes the generated document as an attachment
Common Issues and Solutions
I cannot find the Send Email action
Check these items:
S-Docs is installed in the org
You added an Action, not another element type
You searched for
Send Emailin the action pickerYour user can access S-Docs Apex actions
The email sends, but the document is not attached
Check these items:
Attachments is mapped to the
SDoc IDoutput from Generate DocumentThe generate step runs before the email step
The document was created successfully during the same flow run
The flow finishes, but no email arrives
Check these items:
The email template is active
The flow provides a valid recipient
The recipient email address is real and accessible
Your org allows outbound email from the selected sender
The wrong email content appears
Check these items:
The S-Docs Email Template Name or ID matches the intended template
The template contains the subject and body you expect
The flow is not overriding the subject or recipients unexpectedly
The updated flow does not run from the record page
Check these items:
The newest flow version is Active
The existing flow action still points to this flow
The record page or page layout was saved after earlier action setup
What You've Learned
✅ Extended a Screen Flow to email a generated S-Docs file
✅ Added the S-Docs Send Email action after document generation
✅ Passed the generated SDoc ID into the email action
✅ Reused an S-Docs email template in the flow
✅ Tested the full generate-and-email workflow from a live record
Next Steps
Use Configure Template Settings: Email to set default recipients, subject, and sender behavior.
Use Generate Documents Using Flows if you need to rebuild the base flow first.
Use Generate and Email Your Document to review the end-user workflow on a record page.
Practice Exercise
Extend the same flow to send a second email scenario.
Copy the flow.
Change the email template input to a different S-Docs email template.
Activate the copied flow.
Launch it from a test record.
Confirm the second email uses the new message content and still includes the generated PDF.
Bonus challenges:
Override the recipient in the flow instead of the template.
Add a custom subject for one flow variation.
Repeat the same pattern for an
Accountflow.
Last updated
Was this helpful?

