SOLVED

Global Token for Copyright Date in Email Templates

Go to solution
michellechopin
Level 6

Global Token for Copyright Date in Email Templates

Greetings Community Friends!

 

I attended one of the MUG webinars yesterday and among a number of the amazing tips shared, one was to use a token to update the copyright date in emails. I realize that this is probably used widely but with the way our templates were set up back in the day (we continue to use them because we don't have development resources), ours is set up as part of a module that has to be manually updated each year (and then we have to re-approve Marketing Activities emails)...

 

The code/module currently looks like this in all of our email templates:

michellechopin_0-1705606934929.png

 

When setting up a global token to use the tip from the MUG - $year = $date.get('YYYY') - I realized that, when our new instance was set up, the Marketo partner that supported us set one up (yay!):

  • Email script token: {{my.universal-copyright-year-email}}
  • Velocity script: 

    #set($timeZoneObject = $date.getCalendar().getTimeZone())

    $date.format("yyyy", $date.getDate(), $date.getLocale(), $timeZoneObject.getTimeZone("America/New_York"))

 

However, when I add the token to my email template, the token shows in the footer vs the date - is that because I added it wrong (i.e. should there be something before the token) OR because it's a preview of a template and has to be used in a real email to work?

 

Here's how I updated the above code (replaced "2024" with the token): 

michellechopin_1-1705607519124.png

 

Here's what shows when I preview  the email template:

michellechopin_2-1705607557503.png

 

Caveat: I have a basic understanding of HTML (I can work with what's there and mess around with it), no Velocity experience, and cannot code (and we don't have developers on staff).

 

I appreciate any direction that anyone can give (ideally broken down Barney style 😋)

Michelle

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Global Token for Copyright Date in Email Templates

You wouldn’t expect Velocity tokens to be compiled when looking at an Email Template. Needs to be an email!

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Global Token for Copyright Date in Email Templates

You wouldn’t expect Velocity tokens to be compiled when looking at an Email Template. Needs to be an email!

michellechopin
Level 6

Re: Global Token for Copyright Date in Email Templates

This makes perfect sense @SanfordWhiteman and, after using a template that I updated for a real email, I can see that the current year populates.

 

Thanks for the clarification on that!