Hi, I want to send emails to customers that displays all add-on services they purchased from us, along with the respective ‘get started’ guides for each of the services. We have 12 total add-on services. If they didn’t purchase any add-on, the email should show the text ‘none.’
Per above, the email using my test data should display only 3 add-ons, but for the other 9 add-on services, it’s still showing formatted text (that opens a blank white browser page) where there should be nothing but empty space:
Hi @sgbrux and welcome, we are delighted to have you here!
Thank you for asking the HubSpot Community and thanks for sharing the code!
I’d love to ask some of our Top Experts: Hi @sylvain_tirreau, @zach_threadint and @alyssamwilie do you have suggestions to share with @sgbrux, please?
Have a fantastic day and thanks so much!
Best,
Bérangère
Hi, I updated the code with the snippet you suggested and no change. Here’s
the updated code:
[image: image.png]
And what the email still shows when a customer has no add-ons:
[image: image.png]
{% set has_addons = false %}
{{ contact|pprint }}
{% for i in range(1, 13) %}
{% set addon_name = contact["onboarding_addon" ~ i] %}
{% set addon_link = contact["onboarding_addonlink" ~ i] %}
<p>{{ contact["onboarding_addon" ~ i]|pprint }}</p>
<p>{{ contact["onboarding_addonlink" ~ i]|pprint }}</p>
{% if addon_name != "" and addon_link != "" %}
{% set has_addons = true %}
<p style="margin-left: 80px; line-height: 3;">
{{ addon_name }}: <a href="{{ addon_link }}" style="color: #00b9e5;">Get started</a>
</p>
{% endif %}
{% endfor %}
{% if not has_addons %}
<p style="margin-left: 80px;">None</p>
{% endif %}
Could you now copy/paste this code in your module and copy/paste the result?
If you don’t want to do that (because for example you don’t want to show your data here), you have to check what kind of object you have. Maybe you have to access to the value with {{ you_object.value}} or {{ you_object[‘value’] }}, etc. You have to see where are the data you want to check and use the good keys to access to its. It’s possible also that the key you use is incorrect. But if the empty string is not catched, it’s because the value is not empty: you have to see which kind of data you have here.
If you copy/paste the result here, I will help you.