Hi,
I’ve being strugling with this for a few days now. I have a really weird behavior when trying to split a costumer propriety into my e-mail template.
First - the basics… I created an email with the following code:
{% set navigation = ["Home", "About"] %}
{% do navigation.append("Contact Us") %}
{{navigation|pprint}}<br>
{% for item in navigation %}
<li>{{item}}</li>
{% endfor %}
That worked as expected and the result was:
(SizeLimitingPyList: [Home, About, Contact Us])
- Home
- About
- Contact Us
So far so good…
Next I created a property into my contacts (I’ve tried single line and multiline text). The property contains the following text:
Home;About
Finally I’ve altered my email template code to split on the ; (everything else is the same):
{% set navigation = contact.test_prop_single_line|split(';') %}
{% do navigation.append("Contact Us") %}
{{navigation|pprint}}<br>
{% for item in navigation %}
<li>{{item}}</li>
{% endfor %}
However now I get this weird result:
(SizeLimitingPyList: [Home;About, Contact Us])
- Home;About
- Contact Us
It’s as the split didnt do anything but to convert the string into a list with one element (ignoring the ; character).
Trying the personalization_token it gets even worst:
{% set navigation = personalization_token('contact.test_prop_single_line', '')|split(';') %}
{% do navigation.append("Contact Us") %}
{{navigation|pprint}}<br>
{% for item in navigation %}
<li>{{item}}</li>
{% endfor %}
Outputs:
(SizeLimitingPyList: [{",objectExpression", :", contact_without_defaults.test_prop_single_line", ,",defaultExpression", :", contact.test_prop_single_line", ,",localDefault", :", ", }, Contact Us])
- \{\{personalization_token_internal({"
- objectExpression"
- :"
- contact_without_defaults.test_prop_single_line"
- ,"
- defaultExpression"
- :"
- contact.test_prop_single_line"
- ,"
- localDefault"
- :"
- "
- })\}\}
- Contact Us
Now the split seems to have worked, but it’s splitting into the , and not the ; (and its not getting the actual content of my property)
Any clue what I’m doing wrong? I’ve tried different separators as well - like ` or | but i always get one of the 2 scenarios above.
Ty!