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

  • 23/06/2020
    How to Use Pardot Form Handlers

    Pardot form handlers allow you to use your own forms to post your data to Pardot. A Form handler is a great alternative to use instead of Pardot iFrame forms. They allow you to fully customize the look of your form and submit data to more than 1 database. In this tutorial, you will learn how to create a form handler from scratch.

  • 05/03/2020
    How to Create a Better Date Picker Within Pardot Forms

    Want to be able to restrict the date range of a date picker within your Pardot forms? The default date picker with Pardot does not provide this option, but with a couple of lines of JavaScript, you can enhance the functionality of the date picker. In this tutorial, I’ll show you how to use the jQuery UI date picker within your Pardot form.

  • 09/10/2019
    Creative Ways to Spice Up Your Pardot Forms: Part 2

    The 2nd part of the form customization series is finally here! In part 1, I showed you how to implement the popular floating label technique and how to create searchable, user-friendly dropdowns. In this post, I will show you how to create a conversational, paragraph-style form and how to create a form on a single line.

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 Marketing Operations leader.

Categories
Most Commented
Popular Posts