Currency format in Dynamic content | Community
Skip to main content
March 27, 2017
Question

Currency format in Dynamic content

  • March 27, 2017
  • 1 reply
  • 3170 views

We are wanting to format a currency field in a piece of dynamic content (i.e. show decimal places and comma separators e.g.$2,000.30) but have been told by Marketo that "Script tokens cannot be used in emails which have Dynamic Content".

Has anyone out there successfully used any simple velocity scripting to do this?

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
Level 10
March 28, 2017

It's incorrect to say that Velocity tokens do not work in emails that have dynamic content. They do not work *in the same sections* that are dynamic (this, too, is not completely true,  but I won't get into the exceptions here).

What else is happening in this dyn content section? Is it also segmented? How long is that section?

March 28, 2017

The dynamic content is a segmented table on number of products so basically people with 1 product see a table with 1 row and 3 columns and people with 2 products see a table with 2 rows and 3 columns. 2 of the 3 columns contain currencies so we want to format these with comma separators and decimal points.

I set up a token as follows and this shows correctly in the email preview but breaks when we send an email sample or live send;

$number.currency($${lead.RolloverPrevYearTotal})

SanfordWhiteman
Level 10
March 28, 2017

That doesn't exactly reveal the complexity of the table's HTML, but if it's simple enough just move the segmenting into the Velocity token itself.

#if( $lead.Segment_Number_of_Products == "1 Product")

<td>... stuff for people with 1 product...

#else

<td>... etc. ...

#end

Naturally, using VTL for segmented content ranges from the incredibly awesome to the I-wish-there-were-a-better-way, depending on your specific needs. But it is often the *only* way to accomplish your goal.