Contact tokens in email modules issue

Highlighted
New Contributor

Hi all,

I'm trying to create a module which embeds an image for model/color in emails.

This is the sample code, just trying to estract corresponding codes from the contact token values:

{% set colors = [
   {"code":"a", "name":"Color 1"},
   {"code":"b", "name":"Color 2"},
   {"code":"c", "name":"Color 3"}
]
%}
{% set models = [
   {"code":"01", "name":"Model 1"},
   {"code":"02", "name":"Model 2"},
   {"code":"03", "name":"Model 3"},
]
%}
Model: {{ models|selectattr('name','equalto',contact.pick_your_model)|first|attr('code') }}
Color: {{ colors|selectattr('name','equalto',contact.pick_your_color)|first|attr('code') }}

The output is:

Model:
Color:

I tried with for loops and macros, but same issue.

Seems like contact tokens filtered or used in functions are not processed in real time, while simple contact tokens are.

 

Model: {{ contact.pick_your_model }}
Color: {{ contact.pick_your_color }}

Output is:

Model: Model 1
Color: Color 2

Is it an issue?

Any workaround?

 

Reply
0 Upvotes

0 replies

No replies on this post just yet

No one has replied to this post quite yet. Check back soon to see if someone has a solution, or submit your own reply if you know how to help! Karma is real.

Reply to post

Need help replying? Check out our Community Guidelines