1 Reply Latest reply on Aug 24, 2016 1:40 PM by Sanford Whiteman

    Email script token adding line break

    Hector Perez-Nieto

      Hi

      This is my first post here so not sure if I am posting it in the right forum, hope this doesn't offend anyone if it's not.

       

      I am having some issues with a custom email token:

       

      ##Capitalise first letter of First Name
      #set ($fname = ${lead.FirstName})
      #if($fname.equals(""))
        there
      #else
        $display.capitalize($fname)
      #end
      

       

      And I insert it in an email like this:

      Hi {{my.Capitalise First Name}}. Thanks for getting in touch

       

      However it adds a space before and after the variable and a line break:

      Hi   Nancy

      . Thanks for getting in touch

       

      I have checked 57 times and there are no spaces in the code itself, has anyone had this issue? Any ideas?

       

      Many thanks

        • Re: Email script token adding line break
          Sanford Whiteman

          You should put it in the Products space (a moderator moved it for you this time).

           

          There are in fact spaces carriage returns in your VTL.  They're quite explicit.  Remember that VTL is not specifically designed for HTML output -- it could be used to output plain text.  So whitespace is important by default.  If you want to remove carriage returns from the final output, add a ## right before you hit enter.

           

          Also: $fname.isEmpty() is a built-in method.

          1 of 1 people found this helpful