SOLVED

Re: Velocity: Multiple name in First Name

Go to solution
Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity: Multiple name in First Name

@SanfordWhiteman ,

to completely over complicate this, it becomes an interesting use case for template variables in Velocity 🙂

You could set a global template string variable called something like mktoSubjectLine (no code editing required to control it).

Read the global variable into Velocity using your black magic trick

Drop my code into the subject line and tada

 

So, working on the theory we have a global variable called mktoSubjectLine set on the template, that can readily be set by anyone with zero technical skills, we then create two tokens

setASubjectStart

 

#define( $subjectLine )

 

 

setASubjectEnd

 

#end

 

 

In the Email

Place this somewhere in the email body

 

{{my.setASubjectStart}}${mktoSubjectLine}{{my.setASubjectEnd}}

 

 

And continue to use the emit a subject line code from my earlier post. 

 

The subject line is now free-text, just not in the actual subject line 🙂

 

Talk about an over engineered solution!!!

Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity: Multiple name in First Name

@Vidhi_Kare ,

to take my slightly bonkers solution even further, you can place ALL of this in the subject line:

 

 

{{my.setASubjectStart}}this is my super cool subject{{my.setASubjectEnd}}{{my.emitASubject}}

 

where my.emitASubject is this code:

 

#set ($firstName = ${lead.FirstName.toLowerCase()})
#if( $firstName.matches("(?i)(.)\1") )
$display.capitalize($subjectLine)
#else
$display.capitalize($firstName), ${subjectLine}
#end

 

Your team can then just edit the subject line BETWEEN the first two tokens.

 

Technically, it functions the same way as the solution using a mkto template variable, but it places the output for the subject line inline in the Subject Line, with no variable required.

 

I believe that is as close as I can get you to nirvana!

 

Cheers

Jo