Velocity Script not printing working hyperlink
I am having an issue with the following code:
##set the variable referrer to the last Marketo Form URL and set to lowercase
#set( $referrer = ${lead.anyvalue.toLowerCase()})
##check value
#if( $referrer.contains("abc"))
#set( $url = "www.abc.com")
#set( $name = "abc")
##second check
#elseif( $referrer.contains("xyz"))
#set( $url = "www.xyz.com")
#set( $name ="xyz")
##fallback
#else
#set( $url = "www.foo.com")
#set( $name ="foo")
#end
##print Outcome
<a href="https://$url">$name</a>
So the code works in basis.
The $name variable works and displays as expected in all cases. The url doesn't work. But only doens't work for the dependent values, the fallback value always shows.
After some testing, I found that if I take the $url out of the href tag and paste them as seperate lines, it works just fine. But, whenever I try to add it to the href tag, it breaks. The output is like this on the URL:
https://%24url/?mkt_tok=tokenhere
Hope anyone can help me out on this because it's driving me nuts. Looking at the documentation (and forum) this should work but clearly doesn't.