How do I show different content based on lead data?

Modified on Thu, 4 Dec at 11:32 AM

How do I show different content based on lead data?

You can check any placeholder — lead fields, select fields, event data, brand data, assigned person, etc.

On this page

Jump to any section using the links below

Hubhus emails support dynamic, conditional content using @if / @else logic.
With this, you can show or hide content depending on lead fields, select values, assigned-person data, or event information.

This lets you personalize messaging without creating multiple templates.


1. Basic @if logic (Hubhus-correct syntax)

The format is:

@if( %placeholder% ){ Content shown when TRUE }@endif

Example:

@if( %assigned_person_name% ){ Your personal consultant is: %assigned_person_name% }@endif

What counts as FALSE?

These non-empty values still evaluate to FALSE:

  • 0

  • false

  • off

  • nej

  • no

  • n

Everything else counts as TRUE.


2. Using @if / @else

@if( %assigned_person_name% ){ Your personal consultant is: %assigned_person_name% }@else{ You do not have a personal consultant yet. }@endif

3. Nested conditions

You can add additional checks inside the first block:

@if( %assigned_person_name% ){ Your personal consultant is: %assigned_person_name% @if( %assigned_person_phone% ){ You can call %assigned_person_firstname% at: %assigned_person_phone% }@endif }@else{ You do not have a personal consultant yet. }@endif

4. Comparisons (==, !=, ~=, >=, <=, >, <)

Examples:

Number comparison

@if( {{post-nr}} >= 6000 ){ For support in Jutland please call: +45 12 34 12 34 }@endif

Date comparison

@if( %lead_created_at% < @str2datetime[-2 weeks] ){ This lead is older than 2 weeks. }@endif

Text comparison (literal text)

@if( %assigned_person_name% == Henrik Omdal ){ You are assigned to our coding expert, Henrik :) }@endif

5. Contains operator (~=)

Checks if a value contains a string (case insensitive):

@if( %lead_company% ~= A/S ){ Company is registered as an A/S. }@endif
@if( %lead_email% ~= @example.com ){ This customer uses an @example.com email. }@endif

6. Logical operators (&& and ||)

OR logic:

@if( %lead_company% == Company A || %lead_company% == Company B ){ We work with both Company A and Company B. }@endif

AND logic:

@if( %lead_company% == Company A && %assigned_person_email% == ho@hubhus.com ){ This lead belongs to Company A AND is handled by HO. }@endif

Important: Brackets not supported

Hubhus evaluates || before &&.
If you need grouped logic, split into multiple @if blocks.


7. Using placeholders inside conditions

You can check any placeholder — lead fields, select fields, event data, brand data, assigned person, etc.

Examples:

Check select-field slug

@if( @select[customer-type,slug] == commercial ){ This is a business customer. }@endif

Check for missing data

@if( %lead_phone% ){ Phone: %lead_phone% }@endif

8. Using conditional HTML components

You can wrap entire HTML blocks inside @if statements.

Example:

<hh-email.button url="@if(%assigned_person_email%){%assigned_person_email%}@else{%brand_contact_email%}@endif">Contact your consultant</hh-email.button>


9. Use the Editor to find placeholders and test logic

Anywhere you can edit content:

Press:

  • CTRL + K on Windows

  • CMD + K on Mac

This opens the Placeholder Search Modal, where you can quickly find:

  • Lead fields

  • Event placeholders

  • HTML components (buttons, signatures, cards, etc.)

  • Page links

  • Booking forms

  • Brand placeholders

  • Assigned-person placeholders

You can search using natural words like:
“address”, “event date”, “signature”, “company”, “assigned person”.

The editor also contains full code reference examples:

  • Variables

  • For loops

  • JSON examples

  • File examples

  • Calendar event examples

  • Relations examples

  • Checklist examples

Use these to test logic before sending real emails.

? Common searches

lead management • lead tracking • customer management

? Also known as

customer • contact • prospect

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article