CMS Development

SStrachan1
Participant

How can an if statement pass if a property doesnt exist?

SOLVE

I have a module that I want to use for statically built emails and I want to use it in automated emails.

 

Here is my code

{% if broker_personalization == yes %}
{% set personalization = "?b="~ broker_one.firstname|lower ~"-"~ broker_one.lastname|lower %}
{% else %}
{% set personalization = "" %}
{% endif %}

I've built an email where the broker_personalization shouldn't output anything.

 

It still outputs ?b=

 

Shouldn't just output nothing?

0 Upvotes
1 Accepted solution
BarryGrennan
Solution
Top Contributor

How can an if statement pass if a property doesnt exist?

SOLVE

Hi, 

 

First thing I'd replace 

{% if broker_personalization == yes %}

with 

{% if broker_personalization == 'yes' %}

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact

 

 

View solution in original post

1 Reply 1
BarryGrennan
Solution
Top Contributor

How can an if statement pass if a property doesnt exist?

SOLVE

Hi, 

 

First thing I'd replace 

{% if broker_personalization == yes %}

with 

{% if broker_personalization == 'yes' %}

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact