7 Replies Latest reply on Mar 28, 2017 1:56 PM by Sanford Whiteman

    Currency format in Dynamic content

      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?

        • Re: Currency format in Dynamic content
          Sanford Whiteman

          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?

            • Re: Currency format in Dynamic content

              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;


                • Re: Currency format in Dynamic content
                  Sanford Whiteman

                  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...
                  <td>... etc. ...


                  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.

                    • Re: Currency format in Dynamic content

                      Sorry, I'm not quite following your response.


                      We have set up a segmentation on products.


                      We have then set up a dynamic content module in our email so that a different table is displayed relevant to each segment.


                      We have set up a token, for example my.Currency, using this code to format a field in currency format;



                      In the email HTML, this is an example of the code we are using to insert this token into;

                      <td style="border-bottom: 1px solid #7ec142; padding: 10px 0; margin: 0;" align="center">

                      <div class="paragraph-table" style="font-family: Arial, sans-serif; font-size: 14px; line-height: 18px; color: #333;"><strong>{{my.Currency:default=edit me}}</strong><br /></div>



                      How would we need to set up a velocity token to format this field lead.RolloverPrevYearTotal in a currency format in a dynamic table?

                        • Re: Currency format in Dynamic content
                          Sanford Whiteman

                          The point is that Velocity is not just for tiny text snippets. Quite the opposite: VTL was designed from the start to output entire web pages. Hence you can output the entire table from a Velocity token.


                          When you use tokens + segments, you aren't using Dynamic Content™ in the sense of a segmented editable section or a segmented snippet.  But you're certainly creating dynamic content, in fact with more flexibility then you can get with the other options (for example, you can nest and interrelate segments).


                          So, simply put, you'd output the <table> from Velocity, checking the value of $lead.Segmentation_<segment name> to determine segment membership and managing rows/columns/formats accordingly.