How to Localize a Date Field in Marketo Using a Velocity Script

In:

Earlier this month I was given the task of localizing the date formatting within a Marketo email. The email referenced a date field within Marketo that was formatted as yyyy-mm-dd. The issue was that it was a global email, sent out to different countries who do not format the date as yyyy-mm-dd. To fix this issue I created a simple velocity script to transform the date value into something that’s recognized within each country. Here’s a breakdown of how I did it and how you can implement something similar in your Marketo instance.

Creating Velocity Scripts in Marketo

Velocity scripts are created within a token under marketing activities inside a program or a folder.

velocity-scripting-marketo

Formatting the Date

Here’s an example of a velocity script that will format the data, based on Country

This example checks if the Country is equal to France or Ireland and then displays the date format in dd-mm-yyyy. If the Country is Germany, then the date format is dd.mm.yyyy. If the Country is blank or any other value other than France, Ireland or Germany, then the default date format will be displayed.

The tricky part is formatting the date. Here’s an overview of what each of the values within the date velocity script means.

date-formatting-marketo-velocity-script

Testing

You can test the script using the send sample email option and selecting a lead that has a date value.

The power of velocity scripts

This is just one example of how you can use velocity scripts in your Marketo emails. Learn how you can use velocity scripts to create more personalized Marketo emails.

Questions?

Send them to me via email, send me a tweet @jennamolby, or leave a comment

Related Posts

  • 05/07/2017
    Make Your Marketo Forms More User-Friendly With This Tip

    I was registering for a webinar this week and when I went to select my Country from the drop-down, I was greeted with a search feature for the drop-down. I immediately started Googling what JavaScript plugin they were using to see if I could use it on Marketo forms. It turns out, you can and not only is it super easy to implement, but it also makes long drop-down in your Marketo forms more user-friendly. I’ll walk you through how I did this in 4 easy steps.






  • 24/05/2017
    8 Tips for Creating Marketo 2.0 Email Templates From Scratch

    Over the past couple of months, I have been creating email templates using the new(ish) email template syntax in Marketo and I’ve learned a couple tricks along the way. To save you from some headaches, here are 8 tips that I’ve learned from creating Marketo 2.0 email templates from scratch.






  • 04/01/2017
    Beautiful Marketo Forms: Styling Checkboxes and Radio Buttons

    Your Marketo forms don’t have to be boring. With a little extra CSS you can create beautiful Marketo forms with customized checkboxes and radio buttons. In this tutorial, I’ll show you how you can style checkboxes and radio buttons within Marketo forms with minimal coding.






2 comment(s)
  • Zach Rogers

    04/10/2016 at 12:31 pm
    Reply

    I LOVE YOU

  • Koushik Saha

    07/07/2016 at 2:46 pm
    Reply

    I'm a Salesforce developer and using velocity script for the first time! This post is really useful. I have a different use case though. I want to show specific field value from a Salesforce Custom object record (which is linked to Salesforce Contact/Marketo lead) in the email body. #set($foo = $Onboard__cList.get(0).IC_Name__c) $foo It works if the Lead has only one related custom object record (Onboard__cList has only one element) but doesn't work if there are multiple.

Leave A Comment

Your email address will not be published. Required fields are marked *

About Me

I’m a Marketing Operations Manager and Marketo Certified Expert who is passionate about front-end development, web design, data, and email marketing. LEARN MORE

Categories
Most Commented
Popular Posts