Hey all,
I’m trying to check if a value/property exists using a personalization token. I need to use the token as the value I am checking needs to be dynamic and change per each page.
Currently this is what my code looks like
{% set lessonID = "1234" %}
{% set testvalu = personalization_token("contact."~lessonID,"null") %}
{% if testvalu == 'null' %}
This checked worked
{% endif %}
The problem is that if the contact property “contact.1234” is not set, then this if statement is not firing.
I have also tried setting a third value in between the testvalu and if statement
{% set lessonID = "firstname" %}
{% set testvalu = personalization_token("contact."~lessonID,"null") %}
{% set thirdTest = testvalu %}
{% if thirdTest == 'null' %}
This checked worked
{% endif %}
but this still does not work. I can also confirm that “null” is being set, if I check either {{testvalu}} or {{thirdTest}}, null will be printed on the screen in this instance.
The only other thing to add is I have tried using both single and double quotes when checking my null string value == “null” or == ‘null’ .
Thank you