Re: Email script - simpler way?

Anonymous
Not applicable

Email script - simpler way?

I'm trying to create an email script to build a signature based off lead owner fields that may not always be set (too early in marketing to be assigned). I tried a simple if/else loop and it didn't work. I checked out some of the ifnull syntax I found on the Velocity site, but they weren't working for me. Based off somebody else's conversation string in this community, I came up with something that works, but it just seems like the most un-elegant way to do this, when I'm going through multiple items. Maybe somebody with Velocity/Marketo experience knows how I can trim this down?

## First name

#set( $lo_firstname = ${lead.Lead_Owner_First_Name} )

#set( $blank = "" )

#if ($lo_firstname == $blank)

<!-- alternate content or nested if/else statement to pull by region, etc -->

#else

   <span style="color:#104f6e;font-size:1.2em;"><strong>$lo_firstname</strong></span>

#end

## Last name

#set( $lo_lastname = ${lead.Lead_Owner_Last_Name} )

#set( $blank = "" )

#if ($lo_lastname == $blank)

<!-- alternate content or nested if/else statement to pull by region, etc -->

#else

<span style="color:#104f6e;font-size:1.2em;"><strong> $lo_lastname</strong></span>

#end

## Job Title

#set( $lo_title = ${lead.Lead_Owner_Job_Title} )

#set( $blank = "" )

#if ($lo_title == $blank)

<!-- alternate content or nested if/else statement to pull by region, etc -->

#else

<span style="color:#4e4e4e;font-size:1.2em;"> | $lo_title</span>

#end

4 REPLIES 4
Josh_Hill13
Level 10 - Champion Alumni

Re: Email script - simpler way?

In this situation, why not use the default Token?

{{lead.Lead Owner Email Address:default=hello@companyname.com}}

and do this for all of these. Can be a real person or "fake" person.

Anonymous
Not applicable

Re: Email script - simpler way?

That's how I had it before. I'm trying to do two things: The first is create a consistent, styled signature for emails. This way all I have to drop in is my.Signature, and it will always render the same. The other reason, is that I need to provide nested if statements. So, if there is no Lead owner listed, I need an if statement that creates information based on their region, or other variables.

Grégoire_Miche2
Level 10

Re: Email script - simpler way?

Hi Charles,

with a string field and some change data value that concatenate fields, plus the renowned and mysterious trick from Sanford Whiteman​ to add line breaks in a a field, you can do this.

Nested if's in choices can be done with either using the order of choices, or with smart lists that combine complex criteria and a "member of smart list" in the choice conditions.

-Greg

Grégoire_Miche2
Level 10

Re: Email script - simpler way?

2 alternatives:

  • Use a custom field and set it's value with some "change data value" flow steps and choices:
  • Use a formula field

-Greg