Velociity Scripting to Format Currency Value | Community
Skip to main content
Marc_Comption
Level 2
February 19, 2025
Solved

Velociity Scripting to Format Currency Value

  • February 19, 2025
  • 1 reply
  • 950 views

Hi All, 

 

I am trying to use a currency value from a custom object as a token in an email and can't seem to figure out the right Velocity Scripting to have it format correctly. I want the value to appear in the email formatted as $123.45. Can anyone let me know what adjustments I should make to the script? 

 

#*${dSServiceEventDetails_PROD_cList.get(0).sVCTotalAmount}*# #*${dSServiceEventDetails_PROD_cList.get(0).sVCROClosedDate}*# #set($sortedList = $sorter.sort($dSServiceEventDetails_PROD_cList, "sVCROClosedDate:desc")) #if(!$sortedList.isEmpty()) #set($mostRecentEvent = $sortedList.get(0)) #set($mostRecentTotalAmount = $mostRecentEvent.get("sVCTotalAmount")) $mostRecentTotalAmount #else Call our sales team for your offer! #end

 

Thanks for your help! 

 

Marc

Best answer by SanfordWhiteman

Thanks for making that change. Sounds like you want:

${number.currency($mostRecentTotalAmount)}

 

1 reply

SanfordWhiteman
Level 10
February 19, 2025

Please use the syntax highlighter so your code is readable, then we’ll continue.

 

 

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
February 19, 2025

Thanks for making that change. Sounds like you want:

${number.currency($mostRecentTotalAmount)}

 

Marc_Comption
Level 2
February 20, 2025

Worked great! Thanks Sanford!