Skip to main content
Level 1
Feb 28, 2023 10:02 PM UTC
Question

Velocity Script to convert value into currency

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
User Group Leader
User Group Leader
Feb 28, 2023 10:14 PM UTC

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}

 

Translate