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

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 ID into the email action as an attachment

  • Reuse 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:

The email action needs a valid recipient source. Use your S-Docs email template defaults, or map a recipient value in the flow action.

1

Step 1: Open the existing flow

Start with the flow you built for document generation.

  1. Go to Setup.

  2. Open Flows.

  3. Open your existing flow, such as Generate Opportunity PDF.

You are now back in the flow that already generates the document.

2

Step 2: Add the Send Email action

Insert the email step after document generation.

  1. Click the + between Generate Document and Document Created.

  2. Choose Action.

  3. Search for Send Email.

  4. Select the S-Docs send email action.

  5. Set Label to Send Email.

  6. 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

3

Step 3: Configure the core email inputs

Map the action to the same record, template, and generated file.

In Set Input Values:

  1. Set Base Record ID to {!recordId}.

  2. Enter the exact value for S-Docs Email Template Name or ID.

  3. Set Attachments to the SDoc ID output from Generate Document.

  4. Click Done.

Use the exact S-Docs email template name or record ID.

What you just did:

  • Connected the email action to the current Opportunity

  • Told the action which S-Docs email template to use

  • Attached the file created by the previous step

4

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.

5

Step 5: Update the confirmation screen

Make the final screen match the new workflow.

  1. Open the Document Created screen.

  2. Update the Display Text message.

  3. Use a short message such as:

  1. Click Done.

What you just did:

  • Updated the user-facing result message

  • Confirmed the flow now handles generation and email

6

Step 6: Save and activate the new flow version

Make the updated flow available on the record page.

  1. Click Save.

  2. Save the flow as a new version.

  3. Click Activate.

Your existing record-page flow action can now run the updated version.

7

Step 7: Test the full flow from an Opportunity record

Run the flow from a real record.

  1. Open a test Opportunity.

  2. Launch the flow from the record page.

  3. Let the flow complete.

  4. Verify the generated file appears on the record.

  5. Verify the email arrives.

  6. 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 Opportunity

  • The 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 Email in the action picker

  • Your 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 ID output from Generate Document

  • The 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

Practice Exercise

Extend the same flow to send a second email scenario.

  1. Copy the flow.

  2. Change the email template input to a different S-Docs email template.

  3. Activate the copied flow.

  4. Launch it from a test record.

  5. 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 Account flow.

Last updated

Was this helpful?