Document Templates
Generate professional PDF documents from form submissions using customizable templates with field variables, conditional formatting, and colored text
What This Feature Does
Document Templates allow you to create professional PDF documents from form submissions. Instead of manually copying data into Word or Excel, you define a template once and generate polished documents automatically. Templates can include your branding, formatted layouts, conditional formatting with colors, and all the data from form submissions.
Understanding Templates
How Templates Work
- Create a template with placeholders for form fields
- User submits a form with their data
- Generate document that replaces placeholders with actual values
- Download or share the completed PDF
Template Components
- Static Content: Text, images, and formatting that appear on every document
- Field Variables: Placeholders replaced with submission data using
${field_name}syntax - Conditional Expressions: Show different text based on field values using ternary syntax
- Colored Text: Apply colors to conditional results for visual emphasis
- Table Variables: Repeat data from Table fields
Creating a Template
Setting Up Your First Template
- Navigate to "Forms" in the left sidebar
- Select the form you want to create a template for
- Click the "Templates" tab
- Click "Create Template"
- The template builder opens
Template Builder Interface
Left Panel - Field Variables
- Lists all fields from your form
- Click to insert variable at cursor position
- Shows the variable syntax for each field
Center Canvas - Template Editor
- Rich text editing area
- WYSIWYG formatting (bold, italic, headings, lists, tables)
- Live preview of template with sample data
AI Generation
- Use the AI generator to auto-create a template based on your form fields
- Review and customize the generated template
Field Variables
Basic Variable Syntax
Insert form data using the ${field_name} syntax. Click a field in the left panel to insert it at your cursor, or type it manually.
Example:
Site Inspection Report
Location: ${site_location}
Date: ${inspection_date}
Inspector: ${inspector_name}
When a form is submitted, each ${field_name} is replaced with the actual value from the submission.
How Variables Are Resolved
- Variables match the field name set in the form builder
- If a field has no value in the submission, the variable placeholder remains as-is
- Field names can contain letters, numbers, underscores, and hyphens (e.g.,
${fileupload-e76})
Conditional Formatting
Conditional expressions let you display different text depending on a field's value. This is useful for showing status labels, pass/fail indicators, yes/no answers, and more.
Basic Conditional (Truthy/Falsy Check)
Show one value when a field has data, another when it doesn't:
${field_name ? "Yes" : "No"}
How it works:
- If
field_namehas a value → displays Yes - If
field_nameis empty or not provided → displays No
What counts as "falsy" (empty/false):
- Empty string
- The text
false - The text
noorNo - The text
0 - Null or undefined (field has no value)
Everything else is considered "truthy" (has a value).
Examples:
| Expression | Field Value | Result |
|---|---|---|
${has_ppe ? "Yes" : "No"} | true | Yes |
${has_ppe ? "Yes" : "No"} | (empty) | No |
${comments ? "See below" : "None"} | Looks good | See below |
${comments ? "See below" : "None"} | (empty) | None |
Negated Check
Reverse the condition using !:
${!field_name ? "Not provided" : "Provided"}
- If
field_nameis empty → displays Not provided - If
field_namehas a value → displays Provided
Equality Comparison
Compare a field's value to a specific text:
${field_name === "value" ? "Match text" : "No match text"}
Supported operators:
===or==— equals!==or!=— not equals
Examples:
| Expression | Field Value | Result |
|---|---|---|
${status === "Passed" ? "Passed" : "Failed"} | Passed | Passed |
${status === "Passed" ? "Passed" : "Failed"} | Failed | Failed |
${risk !== "Low" ? "Review required" : "OK"} | High | Review required |
${risk !== "Low" ? "Review required" : "OK"} | Low | OK |
Quote Styles
Both single and double quotes work inside expressions:
${field_name ? "Yes" : "No"}
${field_name ? 'Yes' : 'No'}
Colored Text
You can apply colors to conditional results using the pipe | syntax. Colors appear both in the template preview and in exported PDFs.
Color Syntax
Add a color after the text value, separated by a pipe |:
${field_name ? "text|color" : "text|color"}
Example: Pass/Fail with Colors
Result: ${inspection_passed ? "PASSED|green" : "FAILED|red"}
- If
inspection_passedhas a value → displays PASSED in green - If
inspection_passedis empty → displays FAILED in red
Example: Status with Colors
Risk Level: ${risk_level === "High" ? "HIGH RISK|red" : "Standard|green"}
Example: Yes/No with Colors
PPE Worn: ${has_ppe ? "Yes|green" : "No|red"}
Permit Valid: ${permit_valid ? "Valid|green" : "Expired|red"}
Site Induction: ${site_induction ? "Complete|green" : "Incomplete|orange"}
Available Named Colors
Standard colors:
| Color Name | Example Use |
|---|---|
red | Errors, failures, critical items |
green | Success, passed, approved |
blue | Information, links |
yellow | Warnings, caution |
orange | Moderate risk, pending |
purple | Special, premium |
pink | Highlights |
gray | Disabled, not applicable |
black | Default text |
white | Light text on dark backgrounds |
Semantic colors (aliases):
| Color Name | Same As | Use Case |
|---|---|---|
success | green | Positive outcomes |
error | red | Negative outcomes |
danger | red | Critical warnings |
warning | yellow | Caution indicators |
info | blue | Informational items |
ok | green | Approval indicators |
pass | green | Test/inspection passed |
fail | red | Test/inspection failed |
Custom Colors
You can also use hex color codes or RGB values instead of named colors:
${status ? "Active|#22c55e" : "Inactive|#ef4444"}
${status ? "Active|rgb(34, 197, 94)" : "Inactive|rgb(239, 68, 68)"}
Conditional Formatting Reference
Complete Syntax Summary
| Pattern | Syntax | Example |
|---|---|---|
| Simple variable | ${field} | ${inspector_name} |
| Truthy check | ${field ? "yes" : "no"} | ${has_ppe ? "Yes" : "No"} |
| Negated check | ${!field ? "no" : "yes"} | ${!comments ? "None" : "See below"} |
| Equals | ${field === "val" ? "a" : "b"} | ${status === "Pass" ? "OK" : "Fail"} |
| Not equals | ${field !== "val" ? "a" : "b"} | ${risk !== "Low" ? "Review" : "OK"} |
| With color | ${field ? "text|color" : "text|color"} | ${ok ? "Yes|green" : "No|red"} |
| Equals with color | ${field === "val" ? "text|color" : "text|color"} | ${status === "High" ? "High|red" : "Normal|green"} |
Important Notes
- Field names are case-sensitive —
${Status}and${status}are different - Values inside quotes are compared as plain text
- The color part (after
|) is optional — you can have colored true values and plain false values, or vice versa - If a variable is not found in the form data, the placeholder text
${field_name}appears as-is in the output - Colors work in both the live template preview and the exported PDF
Table Data
For forms with Table fields, you can insert a table variable that automatically generates rows from the submitted data.
Inserting a Table Variable
- Click a Table field from the left panel
- The template inserts
${table_field_name} - When rendered, this is replaced with a full table showing all submitted rows
How Table Variables Work
- Each column from the Table field becomes a column in the output table
- Each row of submitted data becomes a row in the output table
- The table is formatted automatically in the PDF
Rich Text Formatting
The template editor supports full rich text formatting that is preserved in the PDF output:
- Bold, italic, underline, and
strikethroughtext - Headings (H1, H2, H3)
- Bullet lists and numbered lists
- Tables (static content tables, not to be confused with Table field variables)
- Blockquotes
- Horizontal rules
- Images
All formatting is preserved when generating the PDF document.
Template Examples
Safety Inspection Report
SAFETY INSPECTION REPORT
Date: ${inspection_date}
Location: ${site_location}
Inspector: ${inspector_name}
---
INSPECTION SUMMARY
Overall Result: ${overall_status === "Passed" ? "PASSED|green" : "FAILED|red"}
Risk Level: ${risk_level === "High" ? "HIGH RISK|red" : "Standard|green"}
PPE Compliance: ${ppe_compliance ? "Compliant|green" : "Non-compliant|red"}
Permit on Display: ${permit_displayed ? "Yes|green" : "No|red"}
Fire Extinguisher Checked: ${fire_extinguisher ? "Yes|green" : "No|red"}
---
INSPECTION ITEMS
${inspection_items}
---
ADDITIONAL COMMENTS
${comments ? "See comments below" : "No additional comments"}
${comments}
---
Inspector Signature: ${inspector_signature}
Date: ${submission_date}
Daily Site Diary
DAILY SITE DIARY
Project: ${project}
Date: ${diary_date}
Weather: ${weather_conditions}
---
PERSONNEL ON SITE
${workers_table}
---
WORK COMPLETED TODAY
${work_description}
---
ISSUES OR DELAYS
${!issues ? "No issues reported" : "Issues recorded — see below"}
${issues}
---
Submitted by: ${submitted_by}
Equipment Checklist
EQUIPMENT INSPECTION CHECKLIST
Equipment ID: ${equipment_id}
Equipment Type: ${equipment_type}
Inspection Date: ${inspection_date}
Inspector: ${inspector_name}
---
CHECKLIST RESULTS
Brakes: ${brakes_ok ? "Pass|pass" : "Fail|fail"}
Lights: ${lights_ok ? "Pass|pass" : "Fail|fail"}
Tyres: ${tyres_ok ? "Pass|pass" : "Fail|fail"}
Hydraulics: ${hydraulics_ok ? "Pass|pass" : "Fail|fail"}
Seatbelt: ${seatbelt_ok ? "Pass|pass" : "Fail|fail"}
Horn: ${horn_ok ? "Pass|pass" : "Fail|fail"}
Overall Status: ${overall_passed ? "CLEARED FOR USE|success" : "DO NOT OPERATE|danger"}
---
Notes: ${!notes ? "None" : "See below"}
${notes}
Inspector Signature: ${inspector_signature}
Generating Documents
From a Single Submission
- Navigate to Submissions
- Open the submission you want to generate a document for
- Click "Generate Document"
- Select the template to use
- Click "Generate"
- PDF downloads or opens in a new tab
Bulk Generation
Generate documents for multiple submissions:
- In the submissions list, select multiple rows
- Click "Bulk Actions"
- Select "Generate Documents"
- Choose template
- Click "Generate"
- Download ZIP file with all PDFs
Automated Generation via Workflow
Generate documents automatically on submission:
- Set up a Workflow
- Add "Generate Document" action
- Select template
- Configure delivery:
- Attach to submission
- Email as attachment
- Save to storage
Managing Templates
Editing Templates
- Navigate to form's "Templates" tab
- Click on template to edit
- Make changes
- Save template
Duplicating Templates
- Click actions menu on template
- Select "Duplicate"
- Modify the copy as needed
- Save with a new name
Deleting Templates
- Click actions menu on template
- Select "Delete"
- Confirm deletion
Note: Deleting a template doesn't affect already-generated documents.
Troubleshooting
Variables aren't being replaced
- Verify the syntax uses dollar sign and curly braces:
${field_name} - Check that the field name matches exactly (case-sensitive)
- Ensure the field has a value in the submission
Conditional expression isn't working
- Make sure quotes surround both the true and false values:
${field ? "Yes" : "No"} - Check that the comparison value matches exactly (case-sensitive)
- Verify you're using the correct operator (
===for equals,!==for not equals)
Colors aren't showing
- Make sure the color comes after a pipe character:
"text|green"not"text green" - Check the color name is spelled correctly (see the named colors table above)
- If using hex codes, include the hash:
"text|#22c55e"not"text|22c55e"
Table variable shows placeholder text
- Verify the Table field has data in the submission
- Check that
${table_field_name}matches the exact field name
PDF layout issues
- Check page margins
- Reduce image sizes
- Simplify complex formatting
- Test with less content
Best Practices
- Test with sample data: Use the live preview to verify your template before generating real documents
- Use colors sparingly: Reserve colored text for important status indicators (pass/fail, yes/no)
- Name fields clearly: Use descriptive field names so variables are easy to identify in the template
- Keep it readable: Don't overcrowd templates with too much data
- Consider printing: Test how documents look when printed
- Use conditional formatting for compliance: Highlight non-compliant items with red and compliant items with green
What's Next
After creating templates, you may want to:
- Set up Workflows for automated document generation
- Review Submissions to generate documents
- Configure Permissions for template access
- Learn about AI Form Generator for quick form creation

