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

  • 18/07/2018
    The Best Way to Create a 2 Column Pardot Form

    In this tutorial, I’ll show you the best way to create a two-column Pardot form. This is a follow up on my original post How to Create a 2 Column Pardot Form. By popular request, this new method includes a way to make certain form fields full width. All you have to do is add CSS classes to your form fields and copy & paste the CSS provided into Pardot.

  • 11/07/2018
    How To Use UTM Parameters to Capture Lead Source in Pardot

    You might already be using UTM parameters to track your marketing campaigns with Google Analytics, but are you capturing that information when a prospect is created in Pardot? Capturing this data is critical in order to assess the value of your marketing campaign and is a lead management best practice.

  • 29/05/2018
    6 Ways to Use JavaScript to Enhance Your Pardot Forms

    Want to do something with your Pardot form that is not available in the editor? Try using JavaScript! Enhance your forms by using these 6 advanced Pardot form techniques. Learn how to add text between form fields, how to capture URL parameters in hidden fields and more.

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

Welcome to my blog, where I share, tips, tricks, thoughts and solutions that I learn in my daily life as a sales and marketing professional.

LEARN MORE

Categories
Most Commented
Popular Posts