AnsweredAssumed Answered

Velocity email scripting - beginner's guide?

Question asked by 5e1302aba833873f2ee2650d20a68814cbb68b8c on Jan 5, 2017
Latest reply on Feb 10, 2017 by sanford.whiteman

Hi everyone!

 

I'm starting to add email scripts in my emails and I'm looking for a guide for beginners, if this exists somewhere. I understand that Velocity is based on Java and that a Java guide could maybe help as well.

 

I'm trying to display text based on the Postal Code's first character:

 

#if(${lead.PostalCode}.substring(0, 0) == "H")
  #set($city = "Montreal")
#elseif(${lead.PostalCode}.substring(0, 0) == "M")
  #set($city = "Toronto")
#else
  #set($city = "your awesome city")
#end
${city}

This is raising an error, so I'm guessing the substring shouldn't be used this way. Any help will be greatly appreciated.

 

Thomas

Outcomes