SOLVED

Re: Token for year?

Go to solution
Geoff_Krajeski1
Level 10 - Champion Alumni

Token for year?

Is there any way to get the system YEAR in a token?

This is in reference to the copyright date in each of our fulfillment emails.

Rather than having to update hundreds of of FEs each year in January, I would proper and ask if it is possible to get a token for something like {{system.dateYear}}.

1 ACCEPTED SOLUTION

Accepted Solutions
Geoff_Krajeski1
Level 10 - Champion Alumni

Re: Token for year?

This works like a charm!

$date.get('yyyy')

View solution in original post

19 REPLIES 19
Grégoire_Miche2
Level 10

Re: Token for year?

Hi Geoffrey,

A velocity script should be able to do this easily. See http://developers.marketo.com/documentation/velocity-script/

-Greg

Geoff_Krajeski1
Level 10 - Champion Alumni

Re: Token for year?

Thanks Grégoire Michel, I will have to take a look at that!

Geoff_Krajeski1
Level 10 - Champion Alumni

Re: Token for year?

This works like a charm!

$date.get('yyyy')

SanfordWhiteman
Level 10 - Community Moderator

Re: Token for year?

Careful with timezones.  I know it sounds crazy, but unless you know the input and output timezones are the same (not necessarily the case on your Marketo pod/instance) even when only using the YYYY part, you'll be out of alignment for a few of hours around the turn of the year.

Ordinarily, that small period over the whole year isn't a big deal (compared to the regular problems you'll encounter if using full days and times) but since you're specifically using this to roll over into the New Year, if someone double-checks while they're watching the Big Ball drop, they may think it's broken.

Kim_Gandy1
Level 7

Re: Token for year?

Hi Geoff Krajeski​, how do I input this code into the required token field? When I just copy/paste, it errors. Thanks!

Geoff_Krajeski1
Level 10 - Champion Alumni

Re: Token for year?

It is not a token field.  This is velocity scripting Kim Gandy​.  You just add it to your email or template.

It's been working just fine for me and the team at PR Newswire.

If you need further Velocity knowledge you can look here: http://developers.marketo.com/email-scripting/

I have not yet experienced the potential issues Sandy describes above, but will be interested to see come the flip of the year.

Kim_Gandy1
Level 7

Re: Token for year?

Is there any way to create this on a system level? Adding script to each program would be very time consuming.

Geoff_Krajeski1
Level 10 - Champion Alumni

Re: Token for year?

Kim Gandy ,

It unfortunately is a time consuming process (but great for holiday week work LOL).

My recommendation is to create a snippet (honestly) so that the redundancy is one-fold, and you only need to change in one place!

I am still dealing with this in a super large instance with 450+ programs to handle.

Kim_Gandy1
Level 7

Re: Token for year?

Haha, true about holiday work week.

I was able to add this successfully for two programs, but two others became a complete cluster upon adding. Have you ever had trouble with approving email assets after adding this script to email templates? Support "worked" on this all morning, but still never came up with an answer.