Can I use a my.token rich text as defined by a velocity script? | Community
Skip to main content
Will_Thomas
New Participant
July 10, 2018
Solved

Can I use a my.token rich text as defined by a velocity script?

  • July 10, 2018
  • 1 reply
  • 3318 views

I'm trying to create a dynamic content email, where it will use one of a few different rich text my.tokens to populate the content based on variables.

I am defining the variables in one velocity token:

#define( $FocusArea1NoInterest )

{{my.FocusArea1NoInterest}}

#end

#define( $FocusArea1LowInterest )

{{my.FocusArea1LowInterest}}

#end

#define( $FocusArea1HighInterest )

{{my.FocusArea1HighInterest}}

#end

Then in the next token, I am using variables to determine which output to use:

#if (${lead.FocusArea1} == "High")

   #set ($Dynamic1Text0 = $FocusArea1HighInterest)

#elseif (${lead.FocusArea1} == "Low")

   #set ($Dynamic1Text0 = $FocusArea1LowInterest)

#else

   #set ($Dynamic1Text0 = $FocusArea1NoInterest)

#end

Using these two I was able to make $Dynamic1Text0 output {{my.FocusArea1NoInterest}} into an email, but not the rich text contents of that my.token itself.  Is it possible to use the velocity here to actually pick which rich text my token to use?

Best answer by SanfordWhiteman

You can't pair VTL and non-VTL tokens this way.

You can however use VTL to determine whether to output HTML comment tags around non-VTL tokens, which is a way of accomplishing the same visible content.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
July 10, 2018

You can't pair VTL and non-VTL tokens this way.

You can however use VTL to determine whether to output HTML comment tags around non-VTL tokens, which is a way of accomplishing the same visible content.

Will_Thomas
New Participant
July 10, 2018

The reason I was using Velocity was because we want to be able to randomize the order of dynamic content, as well.  I was essentially trying to recreate segmentations here, so that I could use the velocity randomizer (which you created here Lightweight A/B testing using Velocity ) to determine the order of the content.  At this point though, it seems like I should just make one newsletter using segmentations for content, and then clone a few versions and manually change the order of the modules.

SanfordWhiteman
New Participant
July 10, 2018

Yeah, suppressing content with comments is one thing, reordering is another!

Unless you move your content into Velocity (meaning no Rich Text Wysiyg editor) you won't be able to do what you describe.