Re: How can I set current year to be a token?

Anonymous
Not applicable

How can I set current year to be a token?

Am I missing this or can you not have a field "current date" and use it as a token for email and landing page snippets? Not the system date, but "2015" for example to use for copyright info.
Tags (1)
4 REPLIES 4
Anonymous
Not applicable

Re: How can I set current year to be a token?

Hey Eric, you can create tokens in parent folders and they will cascade down into all of the child folders underneath. That might be the easiest method to use year as a token. 
Jep_Castelein2
Level 10

Re: How can I set current year to be a token?

You can also look at using Email Scripting: http://developers.marketo.com/documentation/email-scripting/. It's a little bit more technical, but it would allow you to always have the correct year and not have to manually edit it. 
Joe_Fusaro
Level 2

Re: How can I set current year to be a token?

Hi Eric, I know this post is a few years old but here's what worked for me:

Create an email script token in Active Marketo Tokens. I called it "Current Year"

Screen Shot 2019-01-03 at 9.35.21 AM.png

Open the email script editor ("Click to edit") and enter the following:

$date.get('yyyy')

That should dynamically populate the current year using Velocity

SanfordWhiteman
Level 10 - Community Moderator

Re: How can I set current year to be a token?

Don't forget the timezone though:

$date.format(

  "yyyy",

  $date,

  $date.getLocale(),

  $date.getTimeZone().getTimeZone("Australia/Canberra")

)

Only matters for one day out of the year, but that may be the day somebody decides to QA it...