Velocity Script to convert value into currency | Community
Skip to main content
New Participant
February 28, 2023
Question

Velocity Script to convert value into currency

  • February 28, 2023
  • 1 reply
  • 710 views

I have a field called Prev YTD Transaction Volume which has numerical data in the format 12387646. I am trying to write a velocity script to present this data in a currency format $12,387,646.00. The token for my field is {{lead.Prev_YTD_Transaction_Volume__c}}

What would be the best way to write the script. I current have the script as below but the value returned is incorrect.

 

#set($total = ${lead.Prev_YTD_Transaction_Volume__c}) #set ($total = $number.currency($total)) ${total}
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
New Participant
February 28, 2023

You’ll need to explain exactly what you mean by “incorrect”.


The code is basically fine if that’s the real field name and it’s an Integer. You don’t need the curly braces within the #set directive, though.

#set( $total = $lead.Prev_YTD_Transaction_Volume__c ) #set( $total = $number.currency($total) ) ${total}