4 Examples of Velocity Email Scripting in Marketo

In:

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.

velocity-scripting-marketo

velocity-scripting-marketo-2

Examples

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.

Questions?

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

Related Posts

  • 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.

  • 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.

7 comment(s)
  • Jaap

    04/02/2019 at 1:31 am
    Reply

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

  • Koushik Saha

    07/07/2016 at 2:47 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. 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
    Reply

    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
      Reply

      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
    Reply

    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
      Reply

      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
      Reply

      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 sales and marketing professional.

LEARN MORE

Categories
Most Commented
Popular Posts