Skip to main content
Marc_Comption
Level 2
Feb 19, 2025 8:45 PM UTC
Solved

Velociity Scripting to Format Currency Value

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

SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Feb 19, 2025 9:08 PM UTC

Thanks for making that change. Sounds like you want:

${number.currency($mostRecentTotalAmount)}

 

3 replies

SanfordWhiteman
User Group Leader
User Group Leader
Feb 19, 2025 8:48 PM UTC

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

 

 

Translate
SanfordWhiteman
User Group Leader
SanfordWhitemanUser Group LeaderAccepted solution
User Group Leader
Feb 19, 2025 9:08 PM UTC

Thanks for making that change. Sounds like you want:

${number.currency($mostRecentTotalAmount)}

 

Translate
Marc_Comption
Level 2
Feb 20, 2025 6:56 PM UTC

Worked great! Thanks Sanford!

Translate