SOLVED

My token extra line breaks

Go to solution
Anonymous
Not applicable

My token extra line breaks

I am having issues with extra spacing and line breaks when using a my.token. Because Marketo can't handle commas in number fields, I've had to create an email script to format large numbers with commas.

But when I use the token in an email, Marketo decides it needs to put that number on its own line. It inserts a line break before and after the token and it doesn't show up in the html nor in the email preview but as soon as you send a test (or an actual email) it screws it up.

Anyone know how to avoid this?
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: My token extra line breaks

Why use the <HTML> and <BODY> tags at all in the script?  Do you have the same spacing problem if you eliminate those tags?  VTL just renders text that you should be able to insert anywhere without indicating that it's HTML.

And that's cool that you're getting it to work in the subject line.  When I try to put a my.token that's a velocity script in the subject line, Marketo gives me the following message:

0EM50000000RNf8.jpg

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Re: My token extra line breaks

Hey Ryan -

That sounds like a useful (and, unfortunately, necessary) script!  If you're willing to share the code, I'd be hapy to test it for you.  I'm trying to build up my own library of useful scripts and this sounds like one I might otherwise have to build myself in the future.

I've had lots of issues with Velocity scripts, but haven't had problems with Marketo injecting extra spaces the way you describe.

-patrick
Anonymous
Not applicable

Re: My token extra line breaks

The following will format the number correctly.

<HTML>
<BODY>
$number.format('##,###', ${lead.numerical_field_c})
</body>
</html>

If you try to use it in a subject line, it displays "<HTML> <BODY> 19 (or whatever number) </body> </html>". And when used in the body of the email, it puts it on its own line.
Anonymous
Not applicable

Re: My token extra line breaks

Why use the <HTML> and <BODY> tags at all in the script?  Do you have the same spacing problem if you eliminate those tags?  VTL just renders text that you should be able to insert anywhere without indicating that it's HTML.

And that's cool that you're getting it to work in the subject line.  When I try to put a my.token that's a velocity script in the subject line, Marketo gives me the following message:

0EM50000000RNf8.jpg
Anonymous
Not applicable

Re: My token extra line breaks

That did the trick! I know nothing of VTL and have been piecing together what I can find online to help me. Thank you!

As far as the subject line, it doesn't do anything - I don't get an error and Marketo won't send the email. It just silently fails. Oh well.
Anonymous
Not applicable

Re: My token extra line breaks

Yeah, silent failures are waaaaay too common with Velocity scripts in Marketo, unfortunately.  I was on the phone with Marketo support yesterday and tried to convince them it was a problem, but of course ... the real-time example I tried to set up didn't actually fail.  It's the kind of thing you experience in the moment and, since you don't always know why it happend, it can be hard to replicate.

Marketo seems to do some very basic checking/validation of scripts at two points:
  1. When an email (or other asset) is published that references the script
  2. When you send a sample test message

Marketo doesn't seem to check for the same kinds of issues in both 1 and 2, so if you edit a script token after the email where it's used is already published, you can end up with silent failures on your test emails (and presumably on your active campaigns).

Seems like the product has a ways to go to make Velocity scripting a friendlier and more reliable/predictable user experience in Marketo.  That said ... I'm still glad it's there.  Just wish it were more robust and fully documented.

-patrick
Anonymous
Not applicable

Re: My token extra line breaks

Ryan -

At the risk of harping on this, if you (or anyone reading this discussion) agrees that we need more documentation from Marketo on Velocity scripting, could you "like" the following idea that I just posted:

https://community.marketo.com/MarketoIdeaDetail?id=08750000000JYPuAAO

Thanks!

-patrick
Calvin_Lam
Level 4

Re: My token extra line breaks

I liked it too