I spent yesterday afternoon attempting to get a module within an email template to work. We have an if statement here that we’d like to utilize based on a variable we’re passing in from our app. No matter what I seem to do, the if statement seems to ignore the variable value and always render the else condition.
As you can see from the code below, I’ve setup a number of tests to attempt figure out whats going on. I wanted to make sure the variable we’re getting from our app (custom.reason) was both available as well as the correct value, I wanted to make sure whatever value I’m comparing to reason is the same value as reason (exceeded) and I wanted to test that our if logic is setup correctly - test1. All of these tests seem to return what’s expected, but when comparing reason vs exceeded ({% if reason == exceeded %}), nothing seems to render - even though the values are the exact same given the test I’ve run. Is it possible to use custom data from our app in this way? I saw a note in docs saying its not possible to use “personalization variables”, but it seems silly to not be able to use our app data. Any help would be appreciated.
Code:
{% set reason = custom.reason %}
{% set exceeded = “exceeded_rewardable_review_count” %}
<p>Reason outside = {{reason}}</p>
<p>Exceeded outside = {{exceeded}}</p>
{% if reason == exceeded %}
<p>Success!</p>
{% endif %}
{% set test1 = "this is a test string" %}
{% if test1 == "this is a test string" %}
<p>Reason inside = {{reason}}</p>
<p>exceeded inside = {{exceeded}}</p>
<p dir="ltr" style="line-height: 125%;"><span style="font-size:15px"><span style="font-family:roboto,helvetica neue,helvetica,arial,sans-serif">
Unfortunately you've reached the maximum number of gift cards we give out for reviews. You can read more about our moderation process and reward guidelines
<a data-click-track-id="5400" href="https://www.g2crowd.com/static/community_guidelines"><u>here.</u></a></span></span></p>
{% elif reason == '' %}
<p>Reason inside = {{reason}}</p>
<p>exceeded inside = {{exceeded}}</p>
<p dir="ltr" style="line-height: 125%;"><span style="font-size:15px"><span style="font-family:roboto,helvetica neue,helvetica,arial,sans-serif">
Unfortunately, you just missed the cut-off to be eligible for a gift card. You can read more about our moderation process and reward guidelines
<a data-click-track-id="9100" href="https://www.g2crowd.com/static/community_guidelines"><u>here.</u></a></span></span></p>
{% endif %}