Set Up Your First Document Template in Dochly
What you'll build
For your first template, we recommend building a simple sales proposal based on the Opportunity object. It covers all the core concepts — merge fields, dynamic data, a line items table, and a signature block — without being as complex as a contract or invoice. Once you understand the pattern, every other document type follows the same process.
Build, preview, and publish a working proposal template that generates from an Opportunity record — with customer details, deal amount, line items, and a signature block all populated automatically.
30–45 minutes for your first template including testing. Subsequent templates take significantly less time once you're familiar with the editor and merge field syntax.
Before starting, make sure you have at least one Opportunity in your Salesforce org with an Account, a Contact, and at least one Opportunity Product added. You'll use this record for live preview testing in Step 6.
Choose your primary object
Every template is linked to one primary Salesforce object. This determines which fields are directly available as merge fields. For your first template, use Opportunity — it gives you access to the widest range of useful fields out of the box.
Opportunity
Best for proposals, quotes, contracts, invoices, and order confirmations. Gives access to deal data, account, contact, and line items.
Account
Best for relationship-level agreements, welcome letters, account summaries. Use when the document isn't tied to a specific deal.
Contract
Best for renewal agreements and contract amendments tied to Salesforce Contract records. Use when your org actively uses the Contract object.
Contact
Best for HR documents, onboarding letters, and correspondence directed at individual people rather than companies or deals.
Case
Best for case summaries, resolution documents, and compliance records tied to customer support cases.
Custom object
Any custom object in your org. Must be added to Dochly's object access list in Settings before it appears as an option in the template editor.
Step-by-step: building your first template
Create a new template
Open the Dochly app from the Salesforce App Launcher. Click the Templates tab, then click New Template.
- Template name: "My First Proposal" — you can rename it later
- Primary object: Opportunity
- Output format: PDF
- Status: Leave as Draft — you'll set it to Active after testing
Click Save to open the template editor.
Add the document structure
In the template editor, add the basic structural sections of your document. For a first proposal template, keep it simple:
- Header: Your company name and the word "PROPOSAL" — static text for now
- Recipient section: Where merge fields for customer details will go (next step)
- Body section: A brief introduction paragraph
- Pricing section: Where the line items table will go (Step 4)
- Signature section: Where signature blocks will go (Step 5)
Use the editor toolbar to apply basic formatting — font, font size, bold for headings. Keep it clean for your first template. For branding guidance see Build a branded document template.
Insert merge fields
In the recipient section, place your cursor where customer data should appear and use the Merge Fields picker in the toolbar to insert fields. Start with these essential fields for a proposal:
Contact: {{Contact.FirstName}} {{Contact.LastName}}
Email: {{Contact.Email}}
Proposal Date: {{TODAY | date: "MMMM d, yyyy"}}
Valid Until: {{Opportunity.CloseDate | date: "MMMM d, yyyy"}}
Reference: {{Opportunity.Name}}
Always use the merge field picker — don't type merge fields manually on your first template. The picker ensures the syntax is always correct. For the full merge field reference see Add Salesforce merge fields to a document template.
Add a line items table
In the pricing section, insert a table with 4 columns: Description, Quantity, Unit Price, Total. Then wrap the data row in a repeat block so it expands automatically based on how many products are on the Opportunity:
---------------------|-----|--------------------|------
{{OpportunityLineItem.Name}} | {{OpportunityLineItem.Quantity}} | {{OpportunityLineItem.UnitPrice | currency}} | {{OpportunityLineItem.TotalPrice | currency}}
Total: {{Opportunity.Amount | currency}}
If your Opportunity doesn't have Products set up yet, the table will be empty on preview — that's fine for now. Test the table specifically with an Opportunity that has products added before publishing.
Add a signature block
At the bottom of the template, add a simple signature section for both parties. When you connect this template to Dochly's native e-signature, these become interactive digital signing fields:
{{Contact.FirstName}} {{Contact.LastName}}, {{Account.Name}}
Approved by: ________________________ Date: ____________
[Your Company Name]
Preview with live data
Click Preview in the template editor toolbar. Select a real Salesforce Opportunity record from the picker — choose one with an Account, Contact, and at least one product. Dochly generates a live preview document showing exactly what the output will look like.
Check these four things in your preview:
All merge fields show real values — no blank spaces, no "{{field}}" raw text, no "null" appearing.
The table shows the correct products from the Opportunity, with quantities and prices populated.
Dates show in readable format (e.g. "June 15, 2026") — not raw Salesforce date strings.
Contact name and company appear correctly in the signature section at the bottom.
If anything looks wrong, return to the editor and fix the issue. Preview again until the output is correct. For common issues see Template editor troubleshooting.
Publish the template
Once the preview looks correct, save the template and change the status from Draft to Active. Active templates are available for generation across your org.
You can now:
- Add a Generate Proposal button to the Opportunity page layout for one-click generation
- Connect the template to a Salesforce Flow for automated generation on stage change
- Generate manually from the Dochly Templates tab by selecting an Opportunity record
Test generation from a real record
With the template Active, generate a real document from a real Opportunity:
- Open an Opportunity record in Salesforce
- Click the Generate Document button (if you added it) or use the Dochly panel on the record
- Select your new template from the list
- Click Generate
- The document appears as a Salesforce File in the record's Files section
Download and open the file to verify it looks correct as a PDF. This is your first successfully generated document from Dochly. For a full test checklist, see Test Dochly after installation.
What to build next
Now that your first template is working, the Template Editor guide series covers everything you need to build more sophisticated templates — conditional logic, branding, specific document types, and managing your template library at scale.
Frequently asked questions
Your first Dochly template is published and generating documents. Next step: Test Dochly after installation in Salesforce — run a complete verification of generation, e-signature, Flow triggers, and user access before rolling out to your wider team.
Rated 5 stars · Native Salesforce app · Free to install