- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Contact Property If Statement in Email
SOLVEDec 1, 2016 2:55 PM
Hello Everyone,
I am attempting to create an email that shows content based on contact properties, but for some reason the if statements don't seem to work. If I put in the HUBL for the contact property it will show up, but the if statement will not.
Here is the code from the email template:
{{contact.do_you_have_small_children_or_pets_}} {% if contact.do_you_have_small_children_or_pets_ == 'Yes' %} <p>Text for small children and pets.</p> {% endif %} {{contact.are_the_windows_in_a_hard_to_reach_spot_}} {% if contact.are_the_windows_in_a_hard_to_reach_spot_ == 'Yes' %} <p>Text for hard to reach windows.</p> {% endif %}
I know the contact properties are correct and are loading because I get the double 'Yes' in the email if I send it as if it is going to the user with the 2 Yes properties. I am thinking there is a problem with the if statement or I am not reading the contact property field properly. Sorry I usually work with PHP.
If anyone has any ideas I would greatly appreciate it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Dec 2, 2016 7:47 AM
if statements with contact properties don't work in email templates.
If you conditionals are blocks of text or paragraphs, you can use multiple rich text modules and smart content in your email template to achieve similar results.
Example structure
Main Email body module (1st paragraph, static text)
Rich Text module, Smart Content (2nd paragraph, conditional 1)
Rich Text (3rd paragraph, static text)
Rich Text module, Smart Content (4rd paragraph, conditional 2)
Rich Text (closing and signature, static text)
It's not the most user friendly approach, but has worked for me several times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Dec 2, 2016 8:16 AM
Was about to write the same but @ndwilliams3 was a little quicker than me 🙂
Maybe some additional Infos about how to create Smart Content in emails:
1. Segment your different groups of contacts in different lists (f.e. List1: property 1 = yes, List2: property 2 = yes)
2. Rich-Text-Modules in emails can be made smart (based on lists or lifecycle-stages):
3. Choose your Lists and create a different email copy for each group of contacts.
Best regards
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content