Help Center Conditional Logic Troubleshooting

Conditional Logic Troubleshooting — Common Errors and Fixes in Dochly

Updated June 2026 10 min read Conditional Logic
This guide covers every category of conditional logic error in Dochly — conditions that never fire, conditions that always fire regardless of the data, wrong field scope, syntax errors in if/else tags, blank document output, table row filter failures, conditional formatting not applying, and related list issues. Each error includes the most likely causes and exact steps to fix it.

First checks before troubleshooting

Before investigating a specific condition error, run through these quick checks. They resolve the majority of conditional logic issues without deeper investigation.

Always preview with real records

Preview the template against actual Salesforce records — not a blank or manually typed test. The preview function in the template editor resolves live field values, so the condition evaluates against real data. A condition that seems wrong often has the expected data missing from the test record.

Verify the field value on the record directly

Before concluding a condition is broken, open the Salesforce record and confirm the field value is exactly what you expect — correct value, correct casing, not blank. Many conditional logic issues are actually data issues — the field doesn't have the value you assumed.

Test both the true and false state

Preview the template with a record where the condition should be true AND a record where it should be false. Confirm both outcomes behave as expected. A condition that "doesn't work" is sometimes working correctly — but the test record doesn't actually meet the condition.

Check for unsaved changes

Conditions don't take effect until the template is saved. If you've added or edited a condition and it's not behaving as expected, check whether you saved the template after making the change. The editor may show the condition but the saved version may be different.


Condition never fires

A show/hide or if/else condition never produces the "true" output — even for records that should pass
Symptom: The section always hides, or the if branch never outputs its content, regardless of the record data.
Most likely causes
  • The comparison value doesn't exactly match the field value — wrong case, extra space, or slightly different wording
  • The field name is incorrect — Dochly can't find the field and treats it as blank, causing the condition to always evaluate as false
  • The field has never been populated on any test record — you're testing with data that doesn't exercise the true branch
  • A checkbox field is being compared with a string — "true" never matches a boolean true
How to fix
  • Open the Salesforce record used for preview. Find the exact field value — copy it directly, don't retype it. Paste into the condition value to eliminate case and whitespace issues
  • Use the field picker in the condition builder instead of typing field names — this guarantees the correct API name and avoids typos
  • For checkbox fields, use the is true operator, not equals "true". See: conditions by field type
  • Test with at least two different records — one that should pass the condition and one that should fail it
// ✗ Wrong — string comparison on a checkbox field {{if Is_Renewal__c == "true"}} // ✓ Correct — boolean operator {{if Is_Renewal__c == true}} // ✗ Wrong — case mismatch on picklist value {{if StageName == "closed won"}} // ✓ Correct — exact picklist label {{if StageName == "Closed Won"}}

Condition always fires

A show/hide condition shows the element on every record — even records that shouldn't pass
Symptom: A section that should be conditional always appears, or always shows regardless of the field value.
Most likely causes
  • Show/Hide action is set to "Hide when true" when it should be "Show when true" — or vice versa
  • The condition uses is not blank on a field that is always populated — effectively always true
  • Multiple conditions with OR logic where one condition is always true — e.g. Amount >= 0 is always true for any non-negative amount
  • The field name resolves to blank (wrong name), and the condition is checking is blank — which is then always true
How to fix
  • Double-check the Action: confirm "Show when true" vs "Hide when true" is the correct setting for your intent
  • Verify the condition field is correct and actually has varying values across records
  • For OR conditions, check each individual condition branch — if any single branch is always true, the OR group is always true
  • Temporarily replace your condition with a clearly impossible one (e.g. Amount > 999999999) — if the section still appears, the condition is not actually being evaluated (may be a saved vs live version issue)

Wrong field scope errors

Condition references a field that doesn't exist in the current scope
Symptom: A row-level condition uses a parent field (e.g. Opportunity.Amount), or a section condition tries to use a child field (e.g. OpportunityLineItem.Quantity). The condition evaluates as blank and always returns false.
Most likely causes
  • A row condition inside a related list table uses a parent object field that is not available at row scope
  • A section-level condition tries to use a child object field — only parent fields are in scope at section level
  • Dot notation is used incorrectly — e.g. Opportunity.Amount inside a row context where the object context is already OpportunityLineItem
How to fix
  • For row conditions that need a parent field: create a formula field on the child object that copies the parent value — e.g. a formula on OpportunityLineItem: Opportunity.Account.Type. Use that formula field in the row condition
  • For section conditions that need a child aggregate: create a rollup summary or formula checkbox on the parent (e.g. Has_Services__c) and use that parent field in the section condition
  • Review the field picker carefully — it only shows fields available in the current scope. If a field doesn't appear in the picker, it's not in scope at that level

Syntax errors in if/else tags

If/else tags render as literal text in the document instead of evaluating
Symptom: The generated document shows {{if StageName == "Closed Won"}} as plain text instead of executing the condition.
Most likely causes
  • The tag uses the wrong bracket type — curly quotes (") instead of straight quotes (")
  • A space is missing between the opening brace and the keyword: {{if not {{ if
  • The tag was typed in a rich-text editor that auto-corrected the syntax — curly quotes, em dashes, or smart apostrophes replacing straight characters
How to fix
  • Always use the Dochly template editor to insert condition tags — use the Insert menu or the condition builder rather than typing tags manually
  • If typing manually, use a plain-text editor first to compose the tag, then paste into the Dochly editor — this avoids smart quote substitution
  • Check that all string values use straight double quotes: "Closed Won" not "Closed Won"
// ✗ Wrong — curly/smart quotes (pasted from Word or email) {{if StageName == "Closed Won"}} // ✓ Correct — straight double quotes {{if StageName == "Closed Won"}} // ✗ Wrong — missing closing tag {{if Amount > 50000}} Volume discount applies. // ✓ Correct — properly closed {{if Amount > 50000}} Volume discount applies. {{/if}}
Content after a nested condition leaks into the wrong branch
Symptom: In a nested if/else, text that should be in the outer else appears inside an inner branch, or closing tags seem to mismatch.
Most likely causes
  • A missing {{/if}} closing tag on an inner condition — the outer else is treated as part of the inner condition's else branch
  • Mismatched nesting depth — a closing tag closes the wrong level of condition
How to fix
  • Count opening {{if tags and closing {{/if}} tags — they must be equal. For every {{if}} there must be exactly one {{/if}}
  • Use consistent indentation when writing nested conditions — align each closing tag with its matching opening tag visually to catch mismatches before saving
  • For complex nested logic, use the visual condition builder (not manual syntax) which automatically manages tag pairing

Blank output or missing content

An if/else branch outputs nothing — a blank space appears where content should be
Symptom: The document has a blank area where an if/else result should appear — no text, no content, but visible white space.
Most likely causes
  • The branch content contains only a merge field that resolves to blank on this record
  • A trailing blank line inside an if/else branch is included in the output even when the branch content is empty
  • The condition is evaluating to the else branch, which has no content — while the if branch has content
How to fix
  • Check the merge field inside the branch on the test record — if {{Custom_Terms__c}} is blank on the record, the branch outputs nothing. Populate the field or add a fallback: {{Custom_Terms__c | default: "Standard terms apply"}}
  • Remove trailing blank lines from inside if/else branches — a blank line inside a branch is included in the output as a blank paragraph
  • Add content to the else branch when needed — an if without an else outputs nothing for the false case, which can leave visible spacing

Table and row filter errors

Table row filter removes all rows — only the header remains
Symptom: After applying a row filter condition, the generated table shows only the header row with no data rows beneath it.
Most likely causes
  • The condition is too restrictive — no child records pass the filter on the test record
  • The field name used in the row condition doesn't match any field on the child object
  • The condition is applied to the header row instead of the data row — the header is hidden, making it look like all rows are gone
How to fix
  • Confirm the test record has at least one child record that meets the condition — open the Salesforce record and check the related list directly
  • Temporarily remove the row condition entirely and preview — confirm all rows appear with no filter, then re-add the condition
  • In the template editor, confirm the condition is on the data row (the row with merge fields) not the header row
  • Add an empty-state handler: a row with {{if @rowCount == 0}} that shows "No items match" — this confirms when the filter is working but producing zero results vs when the condition is broken

Conditional formatting errors

Conditional formatting is not applying — rows or cells have default styling regardless of field values
Symptom: Formatting rules configured in the Conditional Logic panel don't appear in the generated PDF — all rows show default styling.
Most likely causes
  • The formatting condition was added to a section element instead of the specific row or cell
  • The colour value is specified incorrectly — e.g. "red" instead of a hex code like "#dc2626"
  • The test record's field value doesn't meet the condition — the formatting would apply if it did
How to fix
  • Click the specific row or cell in the template editor and check the Conditional Logic panel — confirm the formatting rule is attached to that element, not a parent container
  • Use hex colour codes for all formatting values — named colours (red, blue) may not be supported in all PDF renderers
  • Verify the field value on the test record meets the condition — preview with a record specifically chosen to trigger the formatting
  • Check the formatting action is set to "Apply Formatting" and not "Show/Hide" — these are distinct actions in the same panel


Quick-reference error table

SymptomMost likely causeFix
Section always hidden Wrong field value case, field name typo, or field is blank on all test records Copy exact field value from Salesforce; use field picker not manual typing
Section always shown Show/Hide action reversed, or condition always true (is not blank on mandatory field) Check action setting; verify condition can actually be false for some records
If/else tag shows as text Curly quotes or missing closing tag Use straight double quotes; use Insert menu not manual typing
Wrong branch outputs Mismatched {{/if}} tags in nested conditions Count opening vs closing tags; use visual builder for nested logic
Blank space in output Merge field in branch is blank, or trailing blank line in branch Add default value filter; remove trailing blank lines inside branches
Table shows only header Row condition too restrictive, wrong field, or applied to header row Confirm records meet filter; check condition is on data row not header
Row filter removes too many rows AND logic when OR was intended, or condition uses wrong field value Review AND/OR setting; check exact field values on affected records
Formatting not applying Condition on wrong element, invalid colour value, or field doesn't meet condition Select specific row/cell; use hex colour codes; preview with matching record
Related list section always visible Condition applied to inner table/row, not outer section container Select outermost section wrapper and apply condition there
@rowCount always returns total Row filter condition not correctly applied to the data row Verify row-level condition is on the repeating data row, not the section

Diagnostic checklist — what to include when contacting support

If you've worked through the relevant sections above and the issue persists, include this information when contacting Dochly support for the fastest resolution.

  • 1
    The template name and whether it is Active, Draft, or a clone being tested
  • 2
    The Salesforce Record ID of the specific record used for preview that shows the incorrect behaviour
  • 3
    A screenshot of the condition configuration (the Conditional Logic panel for the affected element) showing the field, operator, value, and action
  • 4
    The actual field value on the test record — screenshot of the Salesforce record showing the field that the condition is evaluating
  • 5
    What the document currently outputs (screenshot) vs what you expected it to output
  • 6
    For if/else syntax errors: the exact template syntax used — copy and paste the condition tags from the template editor
  • 7
    For related list errors: the parent object, child object, and relationship name being used in the template
  • 8
    Whether the issue is new (worked before and broke) or has never worked — and any recent template edits or Salesforce changes (field updates, picklist changes, profile changes) that may coincide with the issue starting

The most useful pieces of information for conditional logic support cases are: (1) the exact field value on the record and (2) the exact condition configuration. These two things together resolve 80% of conditional logic issues without any further investigation.


Frequently asked questions

Preview and generation both use the same condition evaluation engine — if preview works, generation should work identically. The most common explanation for a discrepancy is that preview was run against a different record than generation. Confirm you're generating from the same record you previewed against, and that the record's field values haven't changed between preview and generation (e.g. a picklist was updated, a checkbox was changed, a formula field recalculated).
When a condition stops working without template changes, the issue is almost always in the data — not the template. Check: (1) Was a Salesforce picklist value renamed or deactivated? A picklist value rename changes the stored value, breaking exact-match conditions; (2) Was a field's data type changed? A text field converted to a picklist behaves differently; (3) Was a formula field updated — changing what it evaluates to? (4) Were field-level security settings changed, restricting the Dochly system user's access to the field?
Add a temporary debug marker inside each branch: {{if condition_A}}[DEBUG: Branch A taken]{{else if condition_B}}[DEBUG: Branch B taken]{{else}}[DEBUG: Else taken]{{/if}}. Generate the document and look for the debug marker — it tells you exactly which branch executed. Then check why the condition for that branch evaluated to true or false on that record. Remove the debug markers before setting the template to Active.
Dochly's generation log (Dochly → Activity → [Record] → Generation Log) shows the overall generation result but does not currently provide a per-condition execution trace. For detailed conditional logic debugging, use the debug marker approach above, or use Dochly preview with different test records to isolate which condition is causing the issue by systematic elimination.

Conditional Logic series complete

You've covered the complete Dochly conditional logic series — from adding your first condition through show/hide, if/else, dynamic tables, conditional formatting, related list logic, and troubleshooting every common error. Your templates now adapt intelligently to every Salesforce record.

Dochly
Salesforce AppExchange — UTECH HUB Install Dochly on AppExchange

Rated 5 stars · Native Salesforce app · Free to install