19 Replies Latest reply on Feb 10, 2017 9:55 AM by Sanford Whiteman

    Velocity email scripting - beginner's guide?

      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")
        #set($city = "your awesome city")

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