Back to the blog

Salesforce document generation: auto-fill templates and send for signature

Salesforce 7 min read 23 September 2026

The problem: manual contracts, broken handoffs and lost files

You should not be copying contract wording into Word, swapping fields by hand, exporting PDFs, then emailing them for signature. If you manage Opportunity-to-Contract processes in Salesforce, manual document work costs hours and creates version-control problems fast. This post explains how to use Salesforce document generation to auto-fill templates and send documents for signature from Salesforce without custom code—or an installed package.

Why Salesforce document generation fails in most orgs

Every admin has seen at least one mess: a 60-page master agreement that needs data from Opportunity, Account and a custom pricing object (Pricing__c). Salespeople export, edit, and re-upload a signed PDF as a File or Attachment. The result is duplicate documents, wrong terms, and reports that don't show signed dates.

Common reasons this happens:

  • Lack of a template process that pulls from multiple related records, so people paste instead.
  • Signature tools that live outside Salesforce, so the signed PDF doesn't automatically land on the right record.
  • Admins unwilling to install packages or write Apex to stitch templates and signatures together.

How Salesforce document generation breaks down (and what to fix)

Fixing this is about three things: reliable data merge, predictable signature flow, and automatic filing. Here’s what you need to check and change, with admin-friendly actions.

1) Template design that reads the right records

Make Word or PDF templates that pull fields from the record where the button lives—Opportunity, Quote or Contract—and from related records. Your template tool should reach up to five levels of parent lookups and include child/grandchild repeating rows for line items or schedules. That means a Quote with 20 line items can produce a repeating table in the finished document without manual assembly.

2) Click triggers instead of custom code

Use a button, a Flow, or a stage change to run the document generation. For an admin that means clicks: add a Quick Action or Flow that the rep presses in the Opportunity. You can also trigger on a stage change (eg, Opportunity.StageName equals "Contract Sent") or when a new file is added to a record.

3) Signature positioning that survives re-pagination

Don’t hard-code X/Y coordinates. Use anchor tags in the template so signature fields stay attached to the right clause even if content shifts. That avoids missing signature boxes when a clause moves to a new page.

4) Identity and security controls that match policy

If you need stronger signer identity, require an emailed one-time code and optionally a per-signer password stored on the signer’s Contact or User record. Those controls can be enforced by the e-signature step so you don’t have to track verification outside Salesforce.

5) Automatic filing and size considerations

Set the process to file the generated and the signed PDF back onto the same record. You can choose Salesforce Files or Notes & Attachments per template. Keep in mind Notes & Attachments has a 25 MB cap; documents up to 40 MB require Files. Configure where each template writes to before you run it in production.

Automate document generation and send documents for signature from Salesforce

Here’s a concrete scenario you can replicate as an admin. Hypothetical numbers to show scale: your sales team has 200 renewals a month, each with a 12-page contract and an average four-day signature chase. You want to reduce that chase and ensure each signed PDF lives on the Contract and Opportunity.

Step-by-step admin flow

  • Create Word templates that use anchor tags for signatures and include merge fields for Opportunity, Contract, Account, Contact, and Pricing__c. Add repeating tables for QuoteLineItem rows if you need line-level detail.
  • Build a Flow that: (a) fills the chosen template from the current Opportunity record and related objects up to five parent levels, (b) saves the generated PDF to Files on the Opportunity, and (c) starts the e-signature run.
  • Configure signer authentication: turn on emailed one-time codes and set optional per-signer password fields read from the Contact record.
  • Choose whether to bundle templates—if a single deal needs a 12-page contract plus a 4-page SOW, bundle them into one signature run so signers see a single combined document and the final signed PDF is written back to the record.
  • Test in a sandbox: the same process will work in production because the connector uses an authorised connection, not a managed package.

What to expect operationally

Once it's live: the rep clicks the Quick Action or the Flow runs on stage change. The system creates a filled PDF, starts the signature through your Circularo account, and writes the signed PDF back to the Opportunity and Contract when signing completes. No manual downloads, no separate uploads, and signed dates are queryable for reporting.

Permissions, audit trail and common gotchas for admins

Two admin points often missed:

  • Make sure the integration user has File upload permissions and that the Flow runs in system context if users shouldn’t need extra rights. Confirm where templates write—Files vs Notes & Attachments—so you don’t hit the 25 MB cap unexpectedly.
  • Because the connector uses an authorised connection and not a managed package, there’s nothing to install for your security team to review. Still validate connection scopes and which user authorises the connector to avoid surprise access issues.

One final gotcha: large bundles or very long documents can approach the 40 MB limit. If you use Notes & Attachments accidentally, Salesforce will block files larger than 25 MB; switch those templates to Files first.

Put it into practice

If you want to stop copy-paste work and make signed PDFs appear back on Opportunity, Contract or Quote records automatically, set up templates that reach related data, use Flows or buttons to trigger generation, and route e-signature through your Circularo account so the signed PDF is written back to the record. That keeps version control intact and makes reporting accurate.

Savvy DocuGen fills Word and PDF templates from any Salesforce record (including up to five parent lookups and repeating child rows), sends for signature through your Circularo account, and writes the signed PDF back to the same record. It uses anchor tags for signature positions, supports emailed one-time codes and per-signer passwords, bundles templates, handles documents up to 40 MB, and works in sandboxes just like production.

Try it in your sandbox today to prove out the flow on an Opportunity and a Contract record.

Read next