Mysterious Velocity Token in Text Version Email

lhan
Level 2

Mysterious Velocity Token in Text Version Email

Hello Marketo Community,

I bumped into a real mysterious velocity token situation recently, while creating an email campaign in Marketo. This campaign consists of 6 emails and each email speaks to three different audience groups (short as AG), each AG having slightly different verbiages and a diff background image. So in my velocity token {{my.EM1AudienceGroup}}, I pulled the fields used to define the AG and lowercased them first and then set the logic as such:

#set ($LowerCaseV1 = $lead.Field1.toLowerCase())
#set ($LowerCaseV2= $lead.Field2.toLowerCase())
#set ($LowerCaseV3= $lead.Field3.toLowerCase())
#if ($LowerCaseV1.contains("abc") || $LowerCaseV2.contains("def") || $LowerCaseV3.contains("ghi"))
verbiage1##
#elseif ($LowerCaseV1.contains("jkl) || $LowerCaseV2.contains("mno") || $LowerCaseV3.contains("pqr")) 
verbiage2##
#else
verbiage3##
#end

It works for EM1 and its text version just fine so I cloned this to create multiple tokens for Em2 for the different verbiages. Em2's tokens also worked fine for its html version, but while placing those into its text version, it broke both versions, the email addresses from the different audience group lists I'm using to test are all showing the default version, not showing the diff background images or verbiages. After rounds of testing, we found that placing this {{my.EM1AudienceGroup}} token to Em2's text email fixes the issue. But that token is completely unrelated to EM2 and prints out content that's not in EM2, so we had to stick it to the very end of EM2's text version footer, hoping no one would read that far. This is really bizarre considering that all EM2's Velocity Tokens have the same logic (sets & ifs) as that token and are completely intact, why does it have to have EM1's audience group token in there for it to work? Any insights into this or sharing of similar experiences are greatly appreciated!

10 REPLIES 10
SanfordWhiteman
Level 10 - Community Moderator

Re: Mysterious Velocity Token in Text Version Email

Please use the Syntax Highlighter ("Insert/Edit Code Sample") to insert your code so it's readable. Then we'll continue.

SanfordWhiteman
Level 10 - Community Moderator

Re: Mysterious Velocity Token in Text Version Email

@lhan please return to your thread and check responses.

lhan
Level 2

Re: Mysterious Velocity Token in Text Version Email

Hi Sandford,

Got it done!

 

Thanks,

Lu

SanfordWhiteman
Level 10 - Community Moderator

Re: Mysterious Velocity Token in Text Version Email

OK.

 

Question 1: Why are you lowercasing and using

String.contains(String)

?

 

Although you haven’t provided samples of your actual values, it seems far more appropriate to use

String.compareToIgnoreCase(String).equals(0)

which is lighter on resources.

lhan
Level 2

Re: Mysterious Velocity Token in Text Version Email

Hi @SanfordWhiteman - I simply wasn't aware of the compareToIgnoreCase function there and was not wanting to bother with cases later on so just lower-cased everything upfront.

SanfordWhiteman
Level 10 - Community Moderator

Re: Mysterious Velocity Token in Text Version Email

OK, just be aware of corner cases (e.g. Turkish) where that won’t work. That’s why the prefab methods exist because you don’t have to know the quite obscure language rules.

lhan
Level 2

Re: Mysterious Velocity Token in Text Version Email

Hi Sanford,

Other than this, anything else that you see that might cause the issue for the Text Version email? It's still very strange.

 

Let me know,

Thanks!

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Mysterious Velocity Token in Text Version Email

You verified all the referenced fields are checked off in the tree in Script Editor?

lhan
Level 2

Re: Mysterious Velocity Token in Text Version Email

yes