Hubhus
ToolsAgent loginSubmit a ticket
All articles

Campaigns & Lead Management / Placeholders

Understanding @if/@else conditional logic

Published 28. sep. 2026, 16.03

TL;DR

Wrap content in @if(%field%){ ... }@endif . Add @else{ ... } for a fallback. Compare with == , != , ~= , < , > . Combine checks with && (AND) or || (OR) - but not both together. Press CTRL+K / CMD+K in any template field to find placeholders instantly.

Conditional logic lets your email and SMS templates show or hide content based on the lead's actual data. Use it to personalize messages, add fallbacks, and build smart dynamic communications without writing code.

4 things to know

  1. Basic @if - show content only if a field has a value. @if(%assigned_person_name%){ Your consultant is: %assigned_person_name% }@endif

    Note: 0, false, off, nej, no, n all evaluate as false even though they are non-empty.

  2. @if / @else - show different content per scenario
  3. Comparison operators - compare values precisely. == equal  ·  != not equal  ·  ~= contains (case-insensitive)  ·  < <= > >=
  4. Logical operators - combine multiple conditions. AND: @if(%field_a% == X && %field_b% == Y){ ... }@endif OR: @if(%field_a% == X || %field_a% == Y){ ... }@endif

    Important: Parentheses are NOT supported. || is evaluated before &&. Don't mix both in the same expression.

Read more

Nested @if statements

@if(%assigned_person_name%){
  Your consultant is: %assigned_person_name%

  @if(%assigned_person_phone%){
    Call %assigned_person_firstname% at: %assigned_person_phone%
  }@endif

}@else{
  You do not have a personal consultant yet.
}@endif

Date comparison

@if(%lead_created_at% < @str2datetime[-2 weeks]){
  Lead is more than 2 weeks old
}@endif

Finding placeholders with CTRL+K / CMD+K

Press CTRL+K (Windows) or CMD+K (Mac) in any template field to open the placeholder search. Search by natural words: "lead name", "event date", "address", "signature". This is the fastest way to find the exact placeholder and avoid typos.

Best practices

  • Use the slug value (not the label) when comparing select fields
  • Always add @else for fallback content in customer-facing templates
  • Use the editor's built-in examples section for for-loops, variables, and JSON patterns
  • Test conditions with real leads before activating
if
else
conditional
logic
Didn't find the answer? Submit a ticket and we'll get back to you as soon as possible.