Introduction

In Manual Doc Gen Test Drive, we see how users can generate documents directly from templates using the CloudFiles Doc-Gen component on record pages. This Test Drive demonstrates the next level — how you can automate document generation using Salesforce Flows and Doc Generation Flow Actions.

Instructions

Follow the same process as described in the Manual Doc Gen Test Drive:

  1. Go to 'Contracts' tab and create a new Contract.
  2. Fill in all the required fields in the 'New Contract' form:
    • 'Account Name' : Choose an existing account or create a new one.
    • 'Price Book' : Select "CloudFiles Price Book" from the options.
    • 'Contract Image URL' : Provide a public URL for an image.
    • 'Contract Start Date' : Pick a date.
    • 'Customer Signed Date' : Pick a date.
    • 'Contract Term' : Enter a numerical value.
    • 'Customer Signed By' : Select an existing contact or create a new one.
    • 'Status' : Leave as default i.e. 'Draft'
  3. Once the Contract is created, edit the Status field and set it to 'Activated' to trigger the flow automation.
  4. Within seconds, a Contract PDF and Excel file will be auto-generated and attached to the record in the 'Files' related list— no clicks needed. You may need to refresh the page to see the changes.

The below image displays the 'Contract' Record page after the generation:

Store Generated Files in Connected External Storage

If you want to see how CloudFiles Document Management & Sharing works alongside Document Generation you can also generate files directly into connected external storage platforms (like SharePoint, Google Drive, One Drive etc.)

After setting the Status field to 'Activated', open the CloudFiles widget in the Files tab of the Contract record. You’ll find the generated files located in the connected external folder.

Note: If you don’t see a connected folder or the files haven’t appeared yet, simply refresh the widget or the page.

Note: If you don’t see a connected folder or the files haven’t appeared yet, simply refresh the widget or the page.

The below image displays a sample 'Contract' pdf file generated:

Implementation

This demo automation was configured using Salesforce Flows configured with Doc Generation Flow Actions :

  • Triggers based on Contract Status field updates
  • Generate Document (Sync) Flow Action is executed.
  • Store them either as Salesforce Files or push them into external storage

The below image displays the 'Contract' Template configuration:

The below image displays the Flow being triggered behind this demo:

For more information, please refer to Doc Generation Flow Actions

Beyond this Test Drive

The Doc Generation Flow Actions can be applied to many real-world automations beyond this simple demo. Below are some extended possibilities:

Auto-Generate Documents on Key Record Updates

Trigger file creation when records reach specific stages or conditions in Salesforce.

Example: When an Opportunity reaches “Closed Won,” automatically generate a Quote and a Thank-You letter, and attach them to the record.

Multi-Format Document Generation

Produce multiple formats of the same template in one go.

Example : From a Contract record, generate a PDF for client signature and a Word copy for internal editing.

Store in Salesforce or External Systems

Decide where to store generated files — natively in Salesforce or in connected storage (SharePoint, Google Drive, OneDrive, AWS S3, etc.).

Example: Generate monthly invoices and save them directly in SharePoint under a customer-specific folder while keeping metadata inside Salesforce.

Dynamic Runtime Variables

Insert values directly from Salesforce records or flow runtime variables into templates.

Example: Pull billing details from related objects or calculate discounts dynamically in real-time and insert them into an invoice.

Screen Flow-Driven Document Generation

Capture values from users during a screen flow and inject them into templates as runtime inputs.

Example: A sales rep runs a screen flow that collects deal terms, payment conditions, and special clauses, then instantly generates a Quote PDF with those details filled in.

Chain with Communication Workflows

Combine with Flows to email, share, or notify users once documents are generated.

Example: After generating a new Service Agreement, automatically email it to the customer with Salesforce email alerts.

Batch Generation at Scale

Run scheduled or batch flows to mass-generate documents for groups of records.

Example: Every quarter, generate performance reports for all active accounts and save them in a client-facing Experience Cloud site.

Enforce PDF Security Controls

Protect sensitive documents with configurable PDF restrictions.

Example: Generate policy documents that cannot be printed or edited, with password protection enabled for opening.

With just a few clicks in Flow Builder, Doc Generation Flow Actions empower you to build sophisticated document generation workflows without writing a single line of code.

There are other test drives available that might be of interest to you as well. Head back to the Test Drive article to continue testing.