Dynamically Showing Module in Email Based on Segment

Highlighted
Level 10 - Community Moderator

Re: Dynamically Showing Module in Email Based on Segment

Preview-by-List is the only preview you should trust for Velocity tokens.

When I create the email draft in the program where the tokens are, I am looking into the code of the email template, and it looks like all of the tokens within the <body> </body> have disappeared.

I think this could be what is causing the issue here.

If there aren't any tokens in the email anymore, yes, that would be a problem.

Highlighted

Re: Dynamically Showing Module in Email Based on Segment

Thanks for all of your help with this. I am thinking the main issue is that these tokens are disappearing, which I am not sure if you've ever run into that before (since it looks like my syntax should be correct with the velocity script token itself).

Highlighted
Level 10 - Community Moderator

Re: Dynamically Showing Module in Email Based on Segment

...these tokens are disappearing, which I am not sure if you've ever run into that before...

No, not if they're there at the moment of approval. Is the same thing happening with non-Velocity {{my.tokens}} and with {{lead.tokens}} in the same section?

Highlighted
Level 5

Re: Dynamically Showing Module in Email Based on Segment


@Bryan_Epstein wrote:

Thanks for all of your help with this. I am thinking the main issue is that these tokens are disappearing, which I am not sure if you've ever run into that before (since it looks like my syntax should be correct with the velocity script token itself).


Bryan,

I know this is rather old, but it occurred to me that you may not be creating the tokens above the email you are working on in the Marketo tree structure.  If you go to the text editor and click the insert token button, then start typing 'my.' etc... do your tokens show up?

 

Also, one little trick I've been using as I have multiple tokens I use to start the commenting process is to set a variable to control the closing comment.  If this was one of my opening comment tokens:

#if($lead.my_special_field.contains("GNG"))
  #set( $storyHidden = false )
#else
  <!--
  #set( $storyHidden = true )
#end

 

then my closing comment token looks like this

#if($storyHidden)
  -->
#end

 

I can use that closing token against any number of opening comment tokens as long as the first token sets the $storyHidden variable.  It means I don't have to remember exactly which closing token to use, and more importantly, I don't have to update logic in two locations of code if the rules for showing/hiding a module change.

 

Cheers

Jo