SOLVED

Velociity Scripting to Format Currency Value

Go to solution
Marc_Comption
Level 2

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

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Velociity Scripting to Format Currency Value

Thanks for making that change. Sounds like you want:

${number.currency($mostRecentTotalAmount)}

 

View solution in original post

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Velociity Scripting to Format Currency Value

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

 

SanfordWhiteman_0-1739998095556.png

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Velociity Scripting to Format Currency Value

Thanks for making that change. Sounds like you want:

${number.currency($mostRecentTotalAmount)}

 

Marc_Comption
Level 2

Re: Velociity Scripting to Format Currency Value

Worked great! Thanks Sanford!