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.
Solved! Go to Solution.
Have you tried using formal notation? Looking at my script library, I believe that's what Sanford taught us all to do. 🙂
<a href="https://${OutputURL}">Click here</a>
What Michael said. But also your first line should be using simple notation:
#set( $referrer = $lead.anyvalue.toLowerCase() )
Use simple notation when calling methods. Use formal notation when creating output or interpolating strings.
Thanks to both. This works like a charm!
What Michael said. But also your first line should be using simple notation:
#set( $referrer = $lead.anyvalue.toLowerCase() )
Use simple notation when calling methods. Use formal notation when creating output or interpolating strings.