Re: Email script token adding line break

Anonymous
Not applicable

Email script token adding line break

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

Tags (1)
3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Email script token adding line break

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
Level 2

Re: Email script token adding line break

So helpful, thanks Sanford!

SanfordWhiteman
Level 10 - Community Moderator

Re: Email script token adding line break

Sure!