Help Center Document Generation Generate Your First Document

How to Generate Your First Document in Salesforce

Updated June 2026 5 min read Document Generation
This guide walks you through generating your first document in Salesforce with Dochly — from clicking the Generate button on a record to viewing the completed PDF in the Files section. The whole process takes under 5 minutes. Before you start, you need at least one Active Dochly template. If you haven't built one yet, see Set up your first document template first.

Before you start

Confirm these three things are in place before generating your first document. Missing any of them is the most common reason first-time generation doesn't work.

  • 1
    At least one Active Dochly template exists — go to Dochly → Templates and confirm at least one template shows Status = Active. If all templates are in Draft, set one to Active before proceeding.
  • 2
    You have the Dochly User (or Dochly Admin) permission set assigned — go to Setup → Users → your user → Permission Set Assignments. If neither Dochly permission set is assigned, you'll see the Dochly app but won't be able to generate. Contact your admin to assign the permission set.
  • 3
    You have a Salesforce record to generate from — an Opportunity, Account, or whichever object your template is based on. The record should have key fields populated (Account name, Contact, amount) so the generated document has real data to display.

3 ways to generate a document in Salesforce

Dochly supports three generation methods — from a button click on a record page, from a Salesforce Flow automation, or from the Dochly app directly. This guide covers the button click method — the fastest way for your first generation.

This guide

Button click on a record

Click the Generate Document button on any Salesforce record page. Select a template, confirm settings, and generate. Best for manual, on-demand generation.

Salesforce Flow automation

Generation triggers automatically based on a record event — stage change, approval completion, or field update. Best for automated workflows. See trigger from Flow.

Scheduled / batch generation

Generate documents for multiple records on a schedule — monthly invoices, renewal notices, compliance reports. See schedule automatic generation.


Step-by-step: button click generation

1

Open your Salesforce record

Navigate to the Salesforce record you want to generate a document from. For most templates this will be an Opportunity, but it can be any object your template is based on — Account, Contract, Case, or a custom object.

Make sure the record has real data in its key fields. An Opportunity should have an Account name, a Contact linked, an Amount, and a Close Date. A document generated from an empty record will have blank merge fields throughout.

2

Click the Generate Document button

Look for the Generate Document button on the record page. It should appear in the record's action buttons area at the top of the page, or in a custom button section if your admin has placed it in the page layout.

If you don't see a Generate Document button, there are two ways to generate:

3

Select your template

A Dochly modal window opens showing available templates for this record type. You'll see all Active templates based on the current record's object.

  • Browse the template list or use the search box to find your template
  • Click the template name to select it — a preview icon may be available to see what the template looks like before generating
  • If no templates appear, the Active templates in your org may not be based on this object type — check Dochly → Templates and verify the object matches
4

Confirm generation settings

Before generating, a settings panel appears allowing you to confirm or adjust:

Output format

PDF, DOCX, or both. Defaults to the format configured in your template settings. PDF is recommended for documents being signed or delivered to customers.

Storage destination

Where the generated file is saved. Default is "Attach to this record" — keeps the document on the Salesforce record you're generating from.

Email on generation

Optional — enter an email address to automatically send the generated document to a recipient immediately after generation. Leave blank to generate without sending.

File name

The name of the generated file. Defaults to your template's configured naming convention — usually [Template Name] — [Record Name] — [Date].

For your first generation, leave all settings at their defaults and proceed.

5

Generate and view the document

Click Generate. The generation process typically completes in 2–5 seconds for standard documents. A success notification appears when complete.

To view the generated document:

  • Click View Document in the success notification — opens the PDF directly
  • Or scroll to the Files related list on the Salesforce record — the generated document appears there as a Salesforce File
  • Click the file name to open it in the Salesforce file viewer, or click the download icon to save it locally

The generated document is stored as a native Salesforce File — you can share it, download it, or send it for e-signature directly from the record. No external storage, no manual uploads needed.


What happens after generation

When Dochly generates a document, several things happen automatically in your Salesforce org:

1
Merge fields are resolved

Dochly reads the Salesforce record and replaces every merge field placeholder in the template with the actual field value — Account name, contact details, deal amount, line items, and any other fields in your template.

2
Document is rendered as PDF (or DOCX)

The populated template is rendered into a formatted document — applying your fonts, colors, table styles, headers, footers, and page layout settings.

3
File is stored on the record

The generated PDF is saved as a Salesforce File (ContentDocument) and attached to the originating record. It appears in the Files related list immediately — no sync delay.

4
Generation event is logged

A generation event is recorded in the Dochly activity log on the record — showing which template was used, who generated it, when, and the resulting file.

5
Email sent (if configured)

If you entered an email address in the generation settings or if your template has email delivery configured, the document is emailed to the recipient automatically with no additional steps required.


Verifying the output

After generating your first document, check these five things to confirm everything worked correctly:

  • File appears in the record's Files related list — scroll down on the Opportunity and confirm the generated PDF is visible in the Files section with the correct file name.
  • All merge fields show correct data — open the PDF and verify the Account name, Contact name, deal amount, and dates all match the Salesforce record exactly.
  • No blank spaces or raw merge field syntax visible — "{{Account.Name}}" appearing in the document means a merge field failed. "Null" appearing means a field was empty on the record.
  • Line items table shows correct products — if your template includes a dynamic table, confirm it shows the correct products with accurate quantities and prices.
  • Document looks correct visually — branding, fonts, layout, and page breaks all look as expected. Compare to your template preview if anything looks different.

If any of these checks fail, see Troubleshooting document generation errors in Salesforce for the specific fix for each type of issue.


Next steps

Now that you've generated your first document, here's what to explore next depending on your use case:

Send it for e-signature

From the generated document on the record, click Send for Signature to collect a legally binding digital signature — without any external platform. The signature request is sent from Salesforce and the signed document is stored back on the record.

Automate generation with a Flow

Instead of clicking Generate manually, build a Salesforce Flow that triggers generation automatically — when an Opportunity stage changes, when a record is created, or when an approval is completed. See trigger generation from a Flow.

Add the button to more page layouts

If you want the Generate Document button on other record types (Account, Contract, Case), add it to those page layouts too. See Add a document generation button.

Generate for multiple records at once

For high-volume use cases — monthly invoices, renewal notices, batch compliance docs — see schedule automatic document generation and run a batch document job.


Frequently asked questions

The Generate Document button must be added to the page layout by a Salesforce admin. See the guide on adding a document generation button to Salesforce. Alternatively, you can generate from the Dochly app directly — open the app, go to Generate, and search for the record you want to generate from.
The template picker only shows Active templates based on the same Salesforce object as the current record. If you're on an Opportunity but your templates are based on Account, they won't appear. Check Dochly → Templates and confirm there is at least one Active template with the correct primary object.
Most single-document generations complete in 2–5 seconds. Longer documents with many pages, complex conditional logic, or large dynamic tables may take up to 15 seconds. Batch generation of multiple documents takes longer but runs in the background without requiring you to wait.
Yes. Each generation creates a new Salesforce File — previous versions are not overwritten unless your storage settings are configured to replace existing files. Multiple generations from the same record appear as separate files in the Files related list, each with a timestamp.
Blank fields in a generated document are almost always caused by the corresponding Salesforce field being empty on the record. Open the record and verify the field has a value. If the field has a value but the document still shows blank, check the merge field API name in the template — a typo causes silent failure. See the troubleshooting guide for more detail.

You've generated your first document in Salesforce with Dochly. Next in this series: Generate a document from any Salesforce record — learn how generation works across all standard and custom objects, not just Opportunities.

Dochly
Salesforce AppExchange — UTECH HUB Install Dochly on AppExchange

Rated 5 stars · Native Salesforce app · Free to install