Products
Document Generation
Generate any doc from Salesforce in 1 click
Template Editor
Conditional Logic
Batch Processing
Native E-Signature
Dochly Storage
Connect cloud storage to any Salesforce record automatically
Industries
🏥
Healthcare
HIPAA native
🏦
Financial Services
🏛️
Government
💻
Technology
🏭
Manufacturing
View all 9 industries →
Departments
📈
Sales
Close deals faster
⚙️
Business Operations
💬
Customer Service
👥
Human Resources
📍
Field Service
View all 8 departments →
Resources
Blog
Case Studies
About Dochly
Help Centre
Contact Us
Dochly Storage Pricing ROI Calculator Start Free Trial
How to Generate Documents in Salesforce: Best Complete Guide (2026) — Dochly Blog
How to Generate Documents in Salesforce: Best Complete Guide 2026
Document Automation Salesforce Integration No-Code Automation 2026

How to Generate Documents in Salesforce: Best Complete Guide (2026)

Salesforce stores everything — your accounts, contacts, opportunities, contracts and cases. But when it's time to turn that data into an actual document, most teams still do it manually: export, paste into Word, format by hand, email out, re-upload to Salesforce.
There's a better way. This guide walks through exactly how to generate documents in Salesforce — natively, automatically and at scale — using Dochly.

Why document generation matters in Salesforce

Salesforce is the system of record for your customer relationships, and document generation closes the loop. It turns the data already in Salesforce into professional, accurate, ready-to-send documents without anyone rekeying a single field.

No manual data entry

Merge fields pull directly from Salesforce records — account names, deal amounts, dates, line items — with zero retyping.

No formatting errors

Templates enforce consistent branding and layout every time, no matter which user generates the document or from which record.

No version confusion

Documents are generated from the current state of the record — not a saved copy from last week that someone forgot to update.

No lost files

Completed documents are stored directly on the Salesforce record that generated them — instantly accessible, always findable.

No compliance gaps

Every document is traceable to the data, the template and the user that produced it — creating a complete, auditable record.

Full automation for ops

Invoices, renewal notices and onboarding packets go out automatically — triggered by Flow, no user action required.

The two approaches to Salesforce document generation

Before building anything, understand the two fundamentally different architectures. They have very different implications for security, reliability and long-term maintenance.

FactorConnector-based toolsNative generation (Dochly)
Data locationLeaves Salesforce's trust boundary on every generationStays within Salesforce's security and compliance boundary
PermissionsManaged separately in the vendor's systemUses existing profiles, permission sets and sharing rules
ReliabilityDepends on external API uptimeNo external credentials or API connections to manage
Audit trailsMay live in the vendor's system, not yoursStored on the Salesforce record
AutomationCustom Apex or webhooks for full integrationWorks directly with Flow and approvals — no custom code
PricingPer-document or per-user fees escalate at scaleNo per-document fees or external dependencies
Who builds itOften needs a developerBuilt by an admin

For regulated industries — healthcare, financial services, legal, government — native generation keeps sensitive data within Salesforce's compliance boundary. Install Dochly from AppExchange and connect to your org in minutes.

Step 1: Define your document types

Map out the documents your team generates regularly before building anything. This surfaces data model gaps, template complexity and trigger requirements upfront — and saves significant rebuilding later.

Sales documents

Quotes, proposals, order confirmations and pricing sheets — typically based on the Opportunity object with related Line Items.

Legal documents

Contracts, NDAs, master service agreements and amendments — often requiring conditional clauses based on deal type, region or tier.

Financial documents

Invoices, statements, renewal notices and payment receipts — often triggered by scheduled batch processing on a monthly cycle.

HR documents

Offer letters, employment agreements and policy acknowledgments — typically triggered when a Candidate or Contact status changes.

Compliance documents

Case summaries, audit reports and regulatory filings — requiring complete audit trails and secure compliance document storage.

Operational documents

Statements of work, project plans and onboarding packets — often multi-section documents pulling from Account, Contact and custom objects.

For each document type, note which object it's based on, which related objects it pulls from, whether content varies by record data, who or what triggers it, and where the output goes. This mapping drives every template and automation decision that follows.

Step 2: Build your document templates

The template is the foundation of your document generation workflow. The Dochly template editor lets you build templates entirely inside Salesforce — inserting merge fields, applying formatting, adding conditional sections and previewing with real record data before publishing.

A. Working with merge fields

Merge fields tell the template where to insert data from the Salesforce record. A merge field for account name might look like {{Account.Name}}. When the document generates, that placeholder is replaced with the actual value.

You can use merge fields for standard fields (Account Name, Opportunity Amount, Contact Email), custom fields on any object, related object fields (Opportunity Line Items, child Contacts), formula fields, and date/time fields with formatting options.

B. Using conditional logic in templates

Conditional logic separates a powerful generation tool from a basic mail merge. Dochly's conditional document logic lets the template respond to its data — showing a liability limitation clause only for Enterprise contracts, adding a data processing addendum only for EU billing countries, or showing a payment plan section only when terms are installment-based.

With conditional logic, one master template handles dozens of variations. See the guides to creating a contract template and a proposal template.

C. Building dynamic tables for line items

Most sales and financial documents include line item tables that vary by deal. A quote template pulling from Opportunity Line Items generates exactly as many rows as there are products — no manual counting, no blank rows, no overflow. Totals are calculated and formatted automatically.

Step 3: Set up document generation triggers

Once templates are ready, define how and when documents get generated. A native Salesforce tool gives you four options, each suited to a different level of automation.

Button click — user triggered

Add a custom button to a record page. The user clicks "Generate Quote," selects the template, and the document is created and attached. Best for documents needing human judgment first — proposals, custom statements of work.

Salesforce Flow — fully automated

Generate from a Flow when a stage changes, a checkbox is checked, a date is reached or an approval completes. Fully hands-off — generated, attached and emailed automatically. See how to trigger from Salesforce Flow.

Approval process integration

Generate from the final step of an approval chain. Example: a quote passes internal pricing approval, and the customer-facing contract is generated and sent for e-signature the moment approval is granted.

Scheduled batch processing

For monthly invoices, weekly reports and quarterly renewal notices, batch processing generates documents for hundreds or thousands of records in one run. See how to schedule automatic generation.

Step 4: Configure document delivery

Generating the document is only half the workflow. You also need to define what happens after it's created — and a native platform handles all four delivery types inside Salesforce.

Attach to record

The document is saved as a Salesforce File on the record that triggered it — accessible to anyone with record access. Documents are stored automatically.

Email to contact

The document is attached to an email sent through Salesforce — logged on the Activity timeline, tracked for opens if email tracking is enabled, and subject to your org's delivery settings.

Send for e-signature

Generation triggers a signature request automatically. With Dochly's native e-signature, signing runs inside Salesforce — see the send for e-signature guide.

Stored with retention policy

Store compliance-sensitive documents in specific Files libraries with retention policies, so they are kept for required periods and ready for audits. See compliance document management.

Step 5: Test before you go live

Test thoroughly before rolling document generation out to users. Run through this checklist:

  • Generate test documents from records with complete data — verify every merge field populates correctly.
  • Generate from records with missing or null fields — confirm blanks are handled gracefully, with no "null" text in the document.
  • Test all conditional logic branches — create records that trigger each condition and verify the right content appears.
  • Trigger every Flow path and confirm documents generate as expected in each scenario.
  • Test batch jobs with a small record set before running at full scale — verify attachments and email delivery.
  • Test as different user profiles — confirm users can only generate documents they should have access to.
  • Verify field-level security is respected — restricted fields should not appear for users without access.
  • Run a complete end-to-end test — trigger, generate, approve, sign, store and verify post-signature automation in one pass.

Edge cases cause the biggest problems. Everything that can happen in production should be tested before it does — including rare scenarios that cause significant issues when they occur.

Common Salesforce document generation use cases

These four workflows run natively inside Salesforce with zero manual steps. Each follows the same pattern: a trigger, generation, delivery and a follow-up action.

Sales quote generation

Opportunity reaches "Proposal Ready" → Flow generates the quote with line items and conditional pricing → Quote attached and emailed to the primary contact → 7-day reminder sends if unsigned

Automated invoice run

Scheduled job fires on the 1st of the month → Batch generates invoices for Opportunities closed in the prior 30 days → Invoices attached and emailed to billing contacts → Invoice status tracked on a custom object

Contract generation at close

Opportunity moves to "Closed Won" → Flow generates the MSA with conditional clauses by contract type and billing country → Sent for e-signature → Signed contract stored and stage updated to "Contract Executed"

Onboarding document delivery

New Account created with Status = Active Customer → Flow generates a welcome packet with account-specific service details → Emailed to the primary contact → Follow-up task created for the account owner

Why native document generation beats manual processes every time

A typical manual document process takes 20 to 40 minutes per document — finding the template, copying data from Salesforce, formatting, exporting, emailing and re-uploading the signed copy. The time cost compounds fast.

MetricManual processNative generation (Dochly)
Time per documentUp to 40 minutesUnder 1 minute
What the user doesCreate, format, send, re-uploadGenerate, attach, email, e-sign — automatically
Time for 60 documents/monthAbout 40 hoursUnder 1 hour — 39 hours reclaimed*

*Nearly a full week of selling time returned every month for a team generating 60 documents.

The result:

  • Faster sales cycles
  • Zero data entry errors
  • Full compliance audit trail
  • Real-time document status
  • Data stays in Salesforce
  • Scales with your volume
Available on Salesforce AppExchange

Dochly by UTECH HUB — Install Free

Templates, merge fields, triggers, delivery and e-signature — all native inside Salesforce.

Install on AppExchange

Generating documents in Salesforce: FAQs

Define your document types, build templates with merge fields and conditional logic, set up triggers (button, Flow, approval or schedule), configure delivery (attach, email, e-signature or archive), and test everything before going live. A native tool like Dochly handles all five steps inside Salesforce.
A merge field is a placeholder in a template, such as {{Account.Name}}, that is replaced with the actual value from the Salesforce record when the document is generated.
Yes. With a native document generation tool, a Salesforce Flow can generate a document when a record changes, an approval completes or a date is reached, and batch processing can generate documents for many records on a schedule.
Connector-based tools send Salesforce data to an external service to build documents. Native tools run inside Salesforce, so data stays within its security boundary, existing permissions apply and no external API connections need maintaining.
No. With Dochly, templates are built in the template editor and generation actions are available directly in Flow Builder, so an admin can set up the full workflow without custom code.

Generating documents in Salesforce doesn't have to mean exporting data, reformatting in Word and manually tracking what went where. With Dochly's native document generation, the entire process — template, merge fields, conditional logic, triggers, delivery and storage — happens inside Salesforce, tied directly to the records that matter. The five steps in this guide take you from manual document chaos to a fully automated workflow.

Explore Dochly pricing, see real customer results, or read how to automate contracts in Salesforce. Your data is already in Salesforce — it's time to put it to work.

Amna Afzaal, Salesforce Developer
Amna Afzaal
Salesforce Developer

Amna works on Salesforce for clinics and life sciences teams, where the data model has to satisfy clinicians and compliance at the same time. She has delivered encounter documentation Flows, patient intake and sharing design on live clinical orgs, and writes about the parts of Health Cloud that only show up once real patient records are in the system.