4 Examples of Velocity Email Scripting in Marketo


Marketo’s velocity email scripting language allows you to create highly personalized emails, based on field values in your Marketo database. The scripting language can be used as a token within emails and as an alternative to Marketo’s dynamic content feature. Here are 4 examples of how you can use velocity scripts for more personalized Marketo emails.

Creating Velocity Scripts

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




Capitalize First Letter of the Lead’s First Name

This will captitalize the first letter of the lead’s first name, even if the value in the Marketo database is lowercase.

Hide First Name Salutation if the First Name Field is Empty

Hide the first name salutation if the first name field is empty using this script.

Greeting Based on Gender

Change the greeting in an email to Ms or Mr based on the lead’s gender.

Display Different Text Based on a Field Value

Display different text in an email based on a field value. This can be a little bit easier than setting up dynamic content, since you don’t have to create segmentation rules.


Email me, send me a tweet @jennamolby, or leave a comment

Related Posts

  • 11/06/2019
    How to Turn Any Email Template into a Pardot Email Template

    Do you know you can turn any email template into a Pardot email template? With a couple of modifications to the HTML, you can have a fully functional Pardot email template which allows you to remove, edit and duplicate sections. In this tutorial, I will show you how to take any free, responsive email template and turn it into a Pardot email template.

  • 06/12/2018
    Creating Pardot Email Templates: Common Questions & Answers

    Can my Pardot email be responsive? Why doesn’t my background image appear in Outlook? Can Pardot emails be drag & drop? I get asked these questions a lot from Pardot users and see them posted frequently in the Trailblazer Community. Let’s dive into these questions as well as other common Pardot email template questions.

  • 24/10/2018
    How to Create a Net Promoter Score Survey in Pardot

    Learn how to build a net promoter score (NPS) survey directly in Pardot. I will show you how to create an NPS survey that asks the recipient to give you a score from 1 – 10 using an in-email rating that directs them to a Pardot landing page to collect more information.

7 comment(s)
  • Jaap

    04/02/2019 at 1:31 am

    Thanks for this tip Jenna, you've saved me a lot of trouble again ;-)!

  • Koushik Saha

    07/07/2016 at 2:47 pm

    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. 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. #set($foo = $Onboard__cList.get(0).IC_Name__c) $foo

  • Devin Leshin

    30/06/2016 at 7:14 am

    I am a novice to all of the Velocity scripting but I used the hide the first name if empty script and had to modify it slightly to work. I changed this: #set ($fname = ${lead.FirstName}) #if($fname.equals("")) #else Hello ${lead.FirstName}), #end to this: #set ($fname = ${lead.FirstName}) #if($fname.equals("")) #else Hello ${lead.FirstName}, #end Had to lose the ) after the else's lead.FirstName. Also, how would I combine the hiding the first name and the capitalization of the first name? That would be handy, I would imagine. Thank you for writing this!

    • Devin Leshin
      to Devin Leshin

      30/06/2016 at 7:15 am

      Sorry, Blog formatted that a bit awkwardly. Basically change Hello ${lead.FirstName}), to Hello ${lead.FirstName},

  • Danny T.

    13/06/2016 at 10:37 am

    This is a really great post. Thanks a bunch for the pointers. There's a weird issue that I noticed occurring where if I use the "capitalize first name" script, it gives me an unwanted space after the lead's first name. So it would look like this: Hello Name , Have you noticed this before?

    • Jenna Molby
      to Danny T.

      13/06/2016 at 12:21 pm

      Hi Danny, Glad you like the post! Yes, I've seen that before. Is the comma in the email or in the script? I found that if you put the comma in the script there's no space after it, for example: Hello $display.capitalize($fname), Let me know if that works for you.

    • Danny T.
      to Jenna Molby

      13/06/2016 at 2:32 pm

      Hey Jenna, I swear Marketo can be so strange sometimes. I tried your suggestion earlier and it removed the comma from the token and email. Although I might have forgotten to save it... Either way, it looks good now! Thanks so much!

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.

Most Commented
Popular Posts