SOLVED

Re: Referring to Local Variables in Tokens

Go to solution
John_Bogdanski3
Level 3

Referring to Local Variables in Tokens

Hello,

I am trying to reference email module local variables in tokens (Velocity and Rich Text), but it appears my email will not render the results.

For example, I have an email module which can set the color of a hyperlink. The link style typically needs to be set to color: ${footerLinkColor}; so the selected color from the module menu appears. This works when adding the style directly to the email or within a snippet.

However, this method does not work when using a token. In either a velocity script token or a rich text token, I add the following, but the color will not render: <a href="https://www.mysite.com" style="color: ${footerLinkColor}">Unsubscribe</a>

Everything else renders and works correctly except for the link color.

Please let me know if there is any thing to do, so this can work. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Referring to Local Variables in Tokens

There are 2 answers to the question.

 

1. The official answer: it's not possible to use mktoVariables within Velocity tokens, just as it's not possible to use other {{my.tokens}} within Velocity tokens. The contexts are separate.

 

2. The unofficial but more accurate answer: it is possible if you’re a skilled Velocity developer, but we can’t fully publicize the process because your emails would... let’s say... void the warranty. Hint: think about the #define directive.

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Referring to Local Variables in Tokens

There are 2 answers to the question.

 

1. The official answer: it's not possible to use mktoVariables within Velocity tokens, just as it's not possible to use other {{my.tokens}} within Velocity tokens. The contexts are separate.

 

2. The unofficial but more accurate answer: it is possible if you’re a skilled Velocity developer, but we can’t fully publicize the process because your emails would... let’s say... void the warranty. Hint: think about the #define directive.

John_Bogdanski3
Level 3

Re: Referring to Local Variables in Tokens

Thank you Sanford. I am going to explore this and other options with some resources.