Skip to main content
Aug 24, 2016 1:42 AM UTC
Question

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

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

3 replies

SanfordWhiteman
User Group Leader
User Group Leader
Aug 24, 2016 8:40 PM UTC

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.

Translate
Kelci_Martinsen
Level 2
Oct 27, 2020 10:23 PM UTC

So helpful, thanks Sanford!

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Oct 27, 2020 10:52 PM UTC

Sure!

Translate