Troubleshooting Document Generation Errors in Salesforce
First checks before troubleshooting
Before investigating a specific error, run through these four quick checks. They resolve the majority of generation issues without any further investigation.
Go to Dochly → Templates and confirm the template is set to Active. Draft templates cannot generate documents. If it shows Draft, change it to Active and retry.
Confirm the generating user has either the Dochly User or Dochly Admin permission set assigned. Go to Setup → Users → [User] → Permission Set Assignments.
Open the record being generated from and confirm key fields have values. Empty merge fields in the document almost always mean the field is empty on the record — not a template bug.
Go to Dochly → Settings → Connection Status. If any indicators show red, resolve those connection issues first — they affect all generation attempts until fixed.
Where to find error logs
Before fixing any error, find the error message. Dochly logs generation errors in several places depending on how generation was triggered:
Error messages appear as an inline notification in the generation modal immediately after the attempt. Also visible in Dochly → Activity Log → filter by the record name.
Salesforce Setup → Flow Error Emails (check your admin inbox), or Setup → Paused and Failed Flow Interviews. Flow errors show the action name and error code.
Dochly → Batch Jobs → [Job Name] → Failed Records. Each failed record shows an error code and description. Click a record to see the full error detail.
Setup → Debug Logs → Add trace flag for the generating user. Run the generation. The debug log shows every Apex call, exception, and DML operation during generation.
Generation fails or produces no output
- Template status is Draft — Draft templates cannot generate
- The generating user lacks the Dochly User permission set
- Storage destination is not configured in Dochly Settings
- The Dochly connection has expired — re-run Setup Wizard
- Confirm template status is Active in Dochly → Templates
- Check the generating user's permission sets in Setup → Users → Permission Set Assignments
- Go to Dochly → Settings → Document Storage and confirm a destination is configured
- Check Dochly → Settings → Connection Status — re-run Setup Wizard if any status shows red
- A merge field references a field API name that no longer exists (field was renamed or deleted)
- A REPEAT block references a related list that is inaccessible or empty
- A conditional block has mismatched IF/END IF tags
- The template contains unsupported syntax introduced by a manual edit
- Copy the exact error message and search for it in this guide or contact Dochly support
- Open the template in Draft mode and check for any recently changed or deleted fields in your org
- Count IF and END IF tags — every IF must have exactly one matching END IF
- Check the Dochly Activity Log for the full error stack trace
- All templates for this object are in Draft status — only Active templates appear
- Templates exist but are based on a different primary object than the current record's type
- The generating user's profile doesn't have access to the Dochly templates tab
- Go to Dochly → Templates — confirm there is at least one Active template for this object type
- Check the template's Primary Object field matches the object type of the record you're generating from
- Confirm the Dochly User permission set is assigned to the generating user
Blank or missing fields in the document
- The field is genuinely empty on the Salesforce record — the most common cause by far
- The field API name in the template has a typo — causing silent blank output
- Field-level security restricts the field for the generating user's profile
- The related object lookup field is empty (e.g. Opportunity has no linked Account)
- Open the Salesforce record and confirm the field has a value — check the field directly
- In Setup → Object Manager, verify the exact field API name — it is case-sensitive
- Check field-level security: Setup → Object Manager → [Object] → Fields → [Field] → Set Field-Level Security
- Add a default value to handle intentionally blank fields:
{{Field.Name | default: "N/A"}}
- Merge field was typed manually instead of inserted via the picker — missing a curly brace or has a space
- Content was pasted from Word or Google Docs which replaced standard curly braces with smart quotes
- The field API name contains a character error that breaks the syntax parser
- Delete the raw merge field and re-insert using the merge field picker — never type manually
- If pasted from an external editor, check for smart curly quotes (" ") replacing standard quotes
- Verify syntax:
{{Object.FieldName}}— double curly braces, no spaces, dot separator
- The Salesforce field exists on the record but is explicitly set to null
- A relationship traversal path leads to a null value (parent record exists but field is null)
- Add a default value to suppress null:
{{Field.Name | default: ""}}outputs blank instead of "null" - Or wrap in a conditional:
{IF Field.Name != null} ... {END IF}hides the section entirely when null
Document not attached to the record
- Storage destination in Dochly Settings is not set to "Attach to originating record"
- The generating user lacks Create access on ContentDocument (Salesforce Files) in their profile
- The file was generated but attached to a parent record (Account or Contact) rather than the current record
- Check Dochly → Settings → Document Storage — confirm "Attach to originating record" is selected
- Check the generating user's profile Object Permissions — they need Create on ContentDocument and ContentVersion
- Check the Files related list on the parent Account or Contact — the file may have been routed there
- Check the Dochly Activity Log — it shows where the file was stored after generation
Permission and access errors
- The user doesn't have the Dochly User or Dochly Admin permission set assigned
- The button hasn't been added to the page layout for this object
- The user's profile has a different page layout assignment than the one with the button
- Assign the Dochly User permission set: Setup → Users → [User] → Permission Set Assignments → Edit Assignments
- Confirm the Generate Document button is on the page layout: Setup → Object Manager → [Object] → Page Layouts
- Check if the user's profile is assigned a different page layout — add the button to all relevant layouts
- Field-level security restricts the blank field for the sales rep's profile — admins bypass FLS by default
- Object-level read permission is missing for the rep on a related object referenced in the template
- For each blank field: Setup → Object Manager → [Object] → Fields & Relationships → [Field] → Set Field-Level Security → grant Read to the rep's profile
- For related object access: Setup → Object Manager → [Related Object] → check the rep's profile has at minimum Read object permission
Flow trigger errors
- The Dochly Generate Document action in the Flow is referencing an Inactive or deleted template
- The Record ID input to the action is not correctly mapped — pointing to the wrong variable
- The Flow is running but encountering a fault that is silently caught by a fault path
- Open the Flow in Setup → Flows → [Flow Name] — check the Generate Document action and verify the Template ID is pointing to an Active template
- Confirm the Record ID input is mapped to
{!$Record.Id}(for record-triggered Flows) or the correct variable - Check Setup → Flow Error Emails — Flow faults are emailed to the admin running the Flow
- Add a fault path to the Generate Document action that creates a Salesforce task or sends an email when it fails — this makes errors visible
Batch job errors
- Specific records in the batch have missing required field values — the template can't resolve a mandatory merge field
- Some records in the report have field-level security restrictions for the batch-running user
- Related object lookups are empty on specific records (e.g. Opportunity has no Account)
- Go to Dochly → Batch Jobs → [Job Name] → Failed Records — review the error message for each failed record
- For "Field not found" errors: open the specific record and check the field mentioned in the error
- Fix the data issue on the failed records, then create a new filtered report containing only those records and re-run a targeted batch job
- Add
| default: ""fallbacks to merge fields in the template that may be empty on some records
E-signature errors
- The Contact email address on the Salesforce record is incorrect or empty
- Salesforce email deliverability is set to "System Email Only" — blocking outbound emails to external recipients
- The email landed in the signer's spam or junk folder
- Verify the Contact email address on the record is correct and complete
- Check Salesforce Setup → Email → Deliverability — set to "All Email" if currently on "System Email Only"
- Ask the signer to check their spam folder and whitelist your Salesforce sending domain
- Use the Dochly signature tracking panel on the record to resend the request
- "Store completed document on record" is not enabled in e-signature settings
- The generating user lacks Create access on ContentDocument for the post-signature storage
- Go to Dochly → Settings → E-Signature → confirm "Store completed document on record" is enabled
- Verify the running user has Create access on ContentDocument in their Salesforce profile
- Download the signed document from the Dochly signature tracking panel as a temporary workaround
Diagnostic checklist — what to check before contacting support
If you've worked through the relevant sections above and the issue persists, use this checklist before contacting Dochly support. Having this information ready significantly speeds up resolution.
- 1Template name and current status (Active / Draft / Inactive)
- 2Salesforce Record ID of the record generation was attempted from
- 3Exact error message from the generation modal, Activity Log, or Flow Error Email
- 4The generating user's Salesforce profile name and which Dochly permission sets are assigned
- 5Whether the issue occurs for all users or only specific profiles
- 6Whether the issue is new (started recently) or has always occurred
- 7Screenshot of the Dochly Connection Status panel (Settings → Connection Status)
- 8For Flow errors: the Flow API name and whether the Flow is active
- 9For batch errors: the batch job name and the error message from the Failed Records list
- 10Any recent Salesforce changes — field renames, profile changes, package updates, or deployments — that may have coincided with the issue starting
Contact Dochly support via the Help Center with the above information. The more context you include, the faster the support team can diagnose and resolve the issue — most issues with a full error message and record ID are resolved in the first response.
Frequently asked questions
If you've worked through this guide and the issue persists, contact Dochly support with the diagnostic checklist information above. Next in this series: Generate documents with Salesforce merge fields with Dochly — the complete merge field reference for document generation.
Rated 5 stars · Native Salesforce app · Free to install