How to Generate Your First Document in Salesforce
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.
-
1At 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.
-
2You 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.
-
3You 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.
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
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.
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:
- Open the Dochly app from the App Launcher → go to Generate → search for and select your record
- Ask your Salesforce admin to add the button to the page layout — see Add a document generation button in Salesforce
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
Confirm generation settings
Before generating, a settings panel appears allowing you to confirm or adjust:
PDF, DOCX, or both. Defaults to the format configured in your template settings. PDF is recommended for documents being signed or delivered to customers.
Where the generated file is saved. Default is "Attach to this record" — keeps the document on the Salesforce record you're generating from.
Optional — enter an email address to automatically send the generated document to a recipient immediately after generation. Leave blank to generate without sending.
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.
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:
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.
The populated template is rendered into a formatted document — applying your fonts, colors, table styles, headers, footers, and page layout settings.
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.
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.
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:
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.
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.
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.
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
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.
Rated 5 stars · Native Salesforce app · Free to install