Ok I am doing nothing very complicated. I am looking at a field which is a picklist of values (specifically currency type). Based on that I need to display a very specific value. I started to write a velocity scrip and tested it and got it to partially work, but when I changed the value to be the price it stopped working. If I could get advice on how to fix this I appreciate it. I put the never version of the script below and appreciate any advise on what I am doing wrong.
##contact currency preference and print specific currency value
#if(${lead.CurrencyIsoCode}=="USD")
#$180
#elseif(${lead.CurrencyIsoCode}=="EUR")
#€144
#elseif(${lead.CurrencyIsoCode}=="AUS")
#$277.20
#elseif(${lead.CurrencyIsoCode}=="JPY")
#¥18,000
#elseif(${lead.CurrencyIsoCode}=="CAD")
#$252
#elseif(${lead.CurrencyIsoCode}=="GBP")
#£144
#else(${lead.CurrencyIsoCode}==$NULL)
#{lead.CurrencyIsoCode}
#end
Solved! Go to Solution.
${formal}
references inside directives, use $simple
==
operator, use .equals
(==
causes hard-to-debug errors)$
to print a dollar sign, use ${esc.d}
#else
doesn’t make sense, #else
doesn’t have conditions
##contact currency preference and print specific currency value
#if( $lead.CurrencyIsoCode.equals("USD") )
${esc.d}180
#elseif( $lead.CurrencyIsoCode.equals("EUR") )
€144
#elseif( $lead.CurrencyIsoCode.equals("AUS") )
${esc.d}277.20
#elseif( $lead.CurrencyIsoCode.equals("JPY") )
¥18,000
#elseif( $lead.CurrencyIsoCode.equals("CAD") )
${esc.d}252
#elseif( $lead.CurrencyIsoCode.equals("GBP") )
£144
#else
${lead.CurrencyIsoCode}
#end
${formal}
references inside directives, use $simple
==
operator, use .equals
(==
causes hard-to-debug errors)$
to print a dollar sign, use ${esc.d}
#else
doesn’t make sense, #else
doesn’t have conditions
##contact currency preference and print specific currency value
#if( $lead.CurrencyIsoCode.equals("USD") )
${esc.d}180
#elseif( $lead.CurrencyIsoCode.equals("EUR") )
€144
#elseif( $lead.CurrencyIsoCode.equals("AUS") )
${esc.d}277.20
#elseif( $lead.CurrencyIsoCode.equals("JPY") )
¥18,000
#elseif( $lead.CurrencyIsoCode.equals("CAD") )
${esc.d}252
#elseif( $lead.CurrencyIsoCode.equals("GBP") )
£144
#else
${lead.CurrencyIsoCode}
#end
Thank you so much for helping me review this and correct the mistakes.
@SanfordWhiteman quick question I have been using this script for a while sometimes it refuses to fire. I make a minor adjustment like adding a set of NULL quotes then deleting them and it then fires correctly, but now I can't get it to run. Do you have any advise on how to make this scripting run more consistently?
What do you mean by “refuses to fire” exactly? On rare occasions a token gets corrupted under the hood and needs to be recreated from scratch, but I’ve never seen this happen with the same piece of code multiple times across different rebuilt tokens.
By refuses to fire I mean the token displays nothing at all and it seems to not be working. In this case after further inspection my college made a mistake and uploaded some of the data under the wrong variable.