Skip to main content

isTruthy and isFalsey

isTruthy and isFalsey are Viewer conditional helpers for controlling content visibility.

Use them when you want to show or hide sections in your documents based on whether a Salesforce field has a value or is empty. Perfect for optional document sections, placeholder text, and conditional content blocks.

Function name meaning (quick reference)

  • isTruthy = value exists / has meaningful content
  • isFalsey = value is empty / missing

isTruthy

Shows a block when the value is considered truthy.

When to use: Display a section only if a field has data.

Scenario: Show account name only when it exists.

isTruthy example: account name
{{#isTruthy Account.Name}}
Account has a name: {{Account.Name}}
{{else}}
Account name is missing
{{/isTruthy}}

isFalsey

Shows a block when the value is considered falsey.

When to use: Display a fallback message when a field is empty.

Scenario: Show a missing-phone message when no phone value exists.

isFalsey example: missing phone
{{#isFalsey Account.Phone}}
Phone is empty or missing
{{else}}
Phone: {{Account.Phone}}
{{/isFalsey}}

Show/Hide a full section (table placeholder)

Use one condition block around the entire section.

Section visibility example
{{#isTruthy Invoice.Items}}
## Invoice Items

<!-- Insert table here -->
{{else}}
No invoice items to display.
{{/isTruthy}}

This keeps output clean by hiding the full section when data is not available.

Opportunity Products example

Opportunity Products section visibility
{{#isTruthy Opportunity.Products}}
## Opportunity Products

<!-- Insert Opportunity Products table here -->
{{else}}
No Opportunity Products found.
{{/isTruthy}}

You can invert this with isFalsey when you prefer to start with a "missing data" message.

Typical falsey values

Common values treated as falsey:

  • false
  • null
  • undefined
  • 0
  • "" (empty string)
  • NaN

Practical field examples

isTruthy example: amount
{{#isTruthy Opportunity.Amount}}
Amount: {{Opportunity.Amount}}
{{else}}
No amount was provided
{{/isTruthy}}
isFalsey example: close date
{{#isFalsey Opportunity.CloseDate}}
Close date is not set
{{/isFalsey}}

isTruthy / isFalsey tips

  • Use isTruthy to show a section only when data exists.
  • Use isFalsey to show fallback text when data is missing.
  • Wrap full sections (like a table area) in one condition block.
  • Keep only one business rule per block so the output stays predictable.

Common Use Cases

How do I show content only when a field has a value?

Use isTruthy to check if a field exists:

{{#isTruthy Account.Website}}
Visit our website: {{Account.Website}}
{{else}}
Website not listed
{{/isTruthy}}

How do I display a fallback message when a field is empty?

Use isFalsey to show placeholder text:

{{#isFalsey Contact.Email}}
Email address not provided
{{else}}
Contact: {{Contact.Email}}
{{/isFalsey}}

How do I conditionally show an entire table section?

Wrap the whole section in one condition block:

{{#isTruthy Opportunity.Products}}
## Line Items
| Product | Quantity | Price |
|---------|----------|-------|
{{#each Opportunity.Products}}
| {{Name}} | {{Quantity}} | {{UnitPrice}} |
{{/each}}
{{else}}
## No Products
No products associated with this opportunity.
{{/isTruthy}}

How do I show a message for fields that might be null or empty?

Use isFalsey to catch missing data:

{{#isFalsey Opportunity.CloseDate}}
⚠️ Close date is not set - update this record
{{else}}
📅 Expected close: {{Opportunity.CloseDate}}
{{/isFalsey}}

More resources