Re: Currency Field on a form

Anonymous
Not applicable

Currency Field on a form

I have a series of custom fields that I created and set them to field type currency. I set up an alert email to notify sales of what was filled out in the form however the formatting for the numbers are not coming through. Example: 5000 is not coming through as 5,000. How do you make the number format to currency (add in the comma and decimal). I thought by selecting currency field this would happen.

6 REPLIES 6
Keith_Nyberg2
Level 9 - Champion Alumni

Re: Currency Field on a form

Hey Amanda,

Based on comments in this similar thread, Annual Revenue Token  I believe the best solution is using a velocity script token as opposed to using the basic field token.

Check out the comment made by Sanford Whiteman​ at the bottom.

Sincerely,

Keith Nyberg

SanfordWhiteman
Level 10 - Community Moderator

Re: Currency Field on a form

Keith is correct, you must use Velocity. Currency merely means a certain type of Float internally, it doesn't directly have anything to do with how something is printed.

Anonymous
Not applicable

Re: Currency Field on a form

Hi Sanford Whiteman​ thanks for writing back! Here is my token that is in my email for the currency field: $ {{lead.$1 Buyout 12 Month Payment:default=}}. In the code I need to update the token with the velocity scripting correct? So the code change would be; from:

THIS       <td valign="top" style="padding: 5px 10px; border-top: solid 1px #d0d0d0; font-size:16px; line-height: 1.75; font-family: Arial, Tahoma, Helvetica, sans-serif;"> $ {{lead.$1 Buyout 12 Month Payment:default=}} </td>:

TO:         <td valign="top" style="padding: 5px 10px; border-top: solid 1px #d0d0d0; font-size:16px; line-height: 1.75; font-family: Arial, Tahoma, Helvetica, sans-serif;"> $ ${esc.d}${number.format(lead.$1 Buyout 12 Month Payment:default=} </td>


?

This is all new to me so any help would be appreciated!

Anonymous
Not applicable

Re: Currency Field on a form

Meant to note, in the discussion Keith shared above the velocity code example didnt have 2 brackets like standard tokens do {{}}. Wasnt sure if that was a typo or on purpose?

SanfordWhiteman
Level 10 - Community Moderator

Re: Currency Field on a form

Amanda, you may be confused about where Velocity code (Velocity Template Language, or VTL) goes.

  • You write Velocity code in the Email Script Editor (the editor that comes up when you add a token of the "Email Script" type).
  • Then the name of the token, {{my.whateveryoucalledit}} goes into your email body, and any output generated via Velocity is embedded into your email content in place of the token (same as with other {{my.tokens}}).
  • Within VTL, you don't use double braces {{}}. VTL syntax uses $ or ${} to denote variables/references where necessary.
  • When you've created a token, make sure you check off the field(s) you're using in the tree that's on the right-hand side of Script Editor.

If you post VTL (or any code, including JS or CSS) here for inspection, make sure you use the Advanced Editor's syntax highlighter:

pastedImage_2.png

Anonymous
Not applicable

Re: Currency Field on a form

Thanks Sanford! Yes I was confused, but that makes sense.

Thanks again!