Conditional Logic Troubleshooting — Common Errors and Fixes in Dochly
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.
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.
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.
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.
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
- 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
- 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
- Show/Hide action is set to "Hide when true" when it should be "Show when true" — or vice versa
- The condition uses
is not blankon 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
- 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
- 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.Amountinside a row context where the object context is already OpportunityLineItem
- 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 StageName == "Closed Won"}} as plain text instead of executing the condition.- The tag uses the wrong bracket type — curly quotes (
") instead of straight quotes (") - A space is missing between the opening brace and the keyword:
{{ifnot{{ 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
- 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}}
- 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
- Count opening
{{iftags 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
- 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
- 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
- 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
- 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
- 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
- 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
| Symptom | Most likely cause | Fix |
|---|---|---|
| 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.
- 1The template name and whether it is Active, Draft, or a clone being tested
- 2The Salesforce Record ID of the specific record used for preview that shows the incorrect behaviour
- 3A screenshot of the condition configuration (the Conditional Logic panel for the affected element) showing the field, operator, value, and action
- 4The actual field value on the test record — screenshot of the Salesforce record showing the field that the condition is evaluating
- 5What the document currently outputs (screenshot) vs what you expected it to output
- 6For if/else syntax errors: the exact template syntax used — copy and paste the condition tags from the template editor
- 7For related list errors: the parent object, child object, and relationship name being used in the template
- 8Whether 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
{{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.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.
Rated 5 stars · Native Salesforce app · Free to install