Skip to main content

Viewer Comparison Helpers

This page shows common comparison helpers you can use in Viewer templates for conditional logic and dynamic content.

Use these helpers to control what sections are shown in your documents based on Salesforce field values. Show or hide content based on field comparisons, status checks, or complex logical conditions.

Function name meaning (quick reference)

  • eq = equal
  • is = is equal to
  • neq = not equal
  • gt = greater than
  • gte = greater than or equal
  • lt = less than
  • lte = less than or equal
  • and = all conditions must be true
  • or = at least one condition is true
  • not = reverse/invert the condition

eq

Checks if two values are equal.

Use it when you want to render content only for one exact value.

Scenario: Show a different section for customer vs non-customer accounts.

eq example: customer account
{{#eq Account.Type "Customer"}}
Customer account section
{{else}}
Non-customer section
{{/eq}}

is

is is commonly used as an alias for equality checks (same idea as eq).

Scenario: Render a checklist only when the opportunity is in Proposal stage.

is example: proposal stage
{{#is Opportunity.StageName "Proposal"}}
Show proposal checklist
{{/is}}

neq

Checks if two values are not equal.

Use it when a section should appear for every value except one.

Scenario: Show next steps unless the opportunity is already closed won.

neq example: exclude closed won
{{#neq Opportunity.StageName "Closed Won"}}
Show "next steps" section
{{/neq}}

gt

Checks if the first value is greater than the second value.

Scenario: Highlight high-value opportunities above 10,000.

gt example: high value threshold
{{#gt Opportunity.Amount 10000}}
Show high-value opportunity note
{{/gt}}

gte

Checks if the first value is greater than or equal to the second value.

Scenario: Trigger manager approval for amounts starting at 50,000.

gte example: manager approval
{{#gte Opportunity.Amount 50000}}
Show manager approval block
{{/gte}}

lt

Checks if the first value is less than the second value.

Scenario: Show a risk warning when probability is below 30.

lt example: low probability
{{#lt Opportunity.Probability 30}}
Show low-probability risk section
{{/lt}}

lte

Checks if the first value is less than or equal to the second value.

Scenario: Apply standard discount text for discounts up to 10.

lte example: discount cap
{{#lte Opportunity.Discount 10}}
Standard discount terms apply
{{/lte}}

and

Checks that all provided conditions are true.

Use it when multiple business rules must pass together.

Scenario: Show approval flow only when amount is high and stage is Proposal.

and example: two rules together
{{#and (gte Opportunity.Amount 50000) (eq Opportunity.StageName "Proposal")}}
Show approval workflow section
{{/and}}

or

Checks that at least one provided condition is true.

Scenario: Show sales-motion content for New Business or Upsell.

or example: one of multiple types
{{#or (eq Opportunity.Type "New Business") (eq Opportunity.Type "Upsell")}}
Show sales motion section
{{/or}}

not

Negates a condition (true becomes false, false becomes true).

Scenario: Render active-opportunity content when stage is not Closed Lost.

not example: invert condition
{{#not (eq Opportunity.StageName "Closed Lost")}}
Show active opportunity content
{{/not}}

Opportunity products example

Use comparison helpers to show/hide details by quantity and price:

Opportunity Products: section + per-row rules
{{#isTruthy Opportunity.Products}}
<!-- Insert Opportunity Products table here -->

{{#each Opportunity.Products}}
{{#gte Quantity 10}}
Bulk quantity discount note for {{ProductName}}
{{/gte}}

{{#gt UnitPrice 1000}}
High unit price approval note for {{ProductName}}
{{/gt}}
{{/each}}
{{else}}
No Opportunity Products found.
{{/isTruthy}}

Combining conditions

Combined rules example
{{#and (gte Opportunity.Amount 50000) (eq Opportunity.StageName "Proposal")}}
Show approval workflow section
{{/and}}

{{#or (eq Opportunity.Type "New Business") (eq Opportunity.Type "Upsell")}}
Show sales motion section
{{/or}}

Quick helper selection guide

  • Use eq / is for exact value matching.
  • Use neq for "anything except this value".
  • Use gt, gte, lt, lte for number-based rules.
  • Use and, or, not to combine or invert conditions.

Common Use Cases

How do I show content only for a specific stage?

Use the eq helper to match an exact value:

{{#eq Opportunity.StageName "Closed Won"}}
Congratulations on closing this opportunity!
{{/eq}}

How do I hide a section for a specific status?

Use the neq helper to exclude one value:

{{#neq Opportunity.StageName "Closed Lost"}}
Show next steps for active opportunities
{{/neq}}

How do I apply rules based on an amount threshold?

Use gte or lte for amount-based logic:

{{#gte Opportunity.Amount 50000}}
This deal requires executive approval
{{/gte}}

How do I combine multiple conditions (AND logic)?

Use and when all conditions must be true:

{{#and (eq Opportunity.StageName "Proposal") (gte Opportunity.Amount 50000)}}
Show approval workflow for large proposals
{{/and}}

How do I show content if ANY condition is true (OR logic)?

Use or for multiple acceptable values:

{{#or (eq Opportunity.Type "New Business") (eq Opportunity.Type "Expansion")}}
Show growth opportunity content
{{/or}}

How do I invert a condition?

Use not to reverse the logic:

{{#not (eq Account.Status "Inactive")}}
Show content for active accounts only
{{/not}}

Comparison helper tips

  • Keep each condition tied to one clear business rule.
  • Prefer explicit thresholds (for example 10000, 50000) instead of vague checks.
  • Use and/or only when combining rules is truly required.
  • Add fallback text when a condition may hide important content.

More resources