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

  • 15/10/2020
    How to Use Flex Fields in Pardot

    Flex fields are custom fields that can be used over and over again to limit the number of one-time-only fields within Pardot and Salesforce. They contain data that is required temporarily to execute a specific event or campaign. Once the data is no longer needed, the fields can be reset to blank using an Engagement Program or Automation Rule

  • 04/10/2020
    How To Embed a Pardot Form on Your Website The Right Way

    Pardot offers 2 methods for embedding forms on your website; embedding using an iframe, and form handlers. While the embedded iFrame forms allow marketers to have control over updating and configuring the forms, using an iFrame isn’t always ideal for website usability. In this tutorial, I will show you how to take advantage of the Pardot iFrame forms and make it look great embedded on your website.

  • 23/09/2020
    7 Ways Pardot Users Can Use Chrome Developer Tools For Troubleshooting & Testing

    Chrome Developer Tools is widely used by developers to help edit pages on-the-fly and diagnose issues. Pardot users can use DevTools to troubleshoot and test landing pages and forms. In this post, I’ll show you 7 ways you can use DevTools, including how to identify errors on a landing page, how to customize the CSS of a form and how to view hidden form field values.

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