Email script token adding line break | Community
Skip to main content
August 24, 2016
Question

Email script token adding line break

  • August 24, 2016
  • 1 reply
  • 2745 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
New Participant
August 24, 2016

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.

Kelci_Martinsen
New Participant
October 27, 2020

So helpful, thanks Sanford!

SanfordWhiteman
New Participant
October 27, 2020

Sure!