Skip to main content
Contributor I
November 18, 2024
Solved

Conditionals not working correctly

  • November 18, 2024
  • 1 reply
  • 42 views

Hello,

I am trying to add a conditional into my plain text campaign. I’ve followed all the steps but still getting no where. Whenever I preview the email nothing is showing, no part of the ‘if’ or the ‘else’. It’s as if I didn’t write anything… 

 

Then when I go to preview:

It’s showing the first dynamic part, so I know it should pull this through… but it doesn’t… I’m so lost. 

 

Please advise!!!

 

Thanks,

Greg

    This topic has been closed for replies.
    Best answer by retention

    Hi ​@gster3000, welcome to the Klaviyo community!

    Just to ask a few follow-on questions:

    • Do you have a field in your Customer Property called “Do you have any of the following conditions” verbatim? 
    • Does the person you’re previewing as have that property value set?  In this case “Saud” - it doesn’t look like he has that field set, otherwise it would show.
    • Can you do a screenshot of a Profile showing what that field looks like, and the expected values that it can have.  For example, I assume its either “yes” or “no”.
    • Remember, for the conditional logic to work, is both case sensitive and has to be exact (including spaces).  So the screenshot above can help me troubleshoot.

    However, I’m going to assume you got the field right,  with a profile that has a value for that field, and I think you mean “yes” or “no” as the possible field values.  Then I would try:

    {% if person|lookup:'Do you have any of the following conditions?' == 'yes' %} yes {% else %} no {% endif %}

    See if that works! 

    1 reply

    retention
    Partner - Platinum
    retentionAnswer
    2025 Champion
    November 18, 2024

    Hi ​@gster3000, welcome to the Klaviyo community!

    Just to ask a few follow-on questions:

    • Do you have a field in your Customer Property called “Do you have any of the following conditions” verbatim? 
    • Does the person you’re previewing as have that property value set?  In this case “Saud” - it doesn’t look like he has that field set, otherwise it would show.
    • Can you do a screenshot of a Profile showing what that field looks like, and the expected values that it can have.  For example, I assume its either “yes” or “no”.
    • Remember, for the conditional logic to work, is both case sensitive and has to be exact (including spaces).  So the screenshot above can help me troubleshoot.

    However, I’m going to assume you got the field right,  with a profile that has a value for that field, and I think you mean “yes” or “no” as the possible field values.  Then I would try:

    {% if person|lookup:'Do you have any of the following conditions?' == 'yes' %} yes {% else %} no {% endif %}

    See if that works! 

    Joseph Hsieh // retentioncommerce.com // X: @retention