Dear fellow Marketo users,
I am trying to write a script for a "if A and B" statement, meaning two variables in "if statement" instead of just one variable. I researched on the Apache Velocity script site, and found "&&" should be used between two variables. So my script writes as below:
#if(${A} =="xx") && (${B} == "xx")
#set ($xx = "xx")
#elseif (${A} == "xx") && (${B} == "xx")
#set ($xx="xx")
#else
#set($xx = "default")
#end
is there any error in my script? I don't seem to get the result i want, but when i use lead to test it, it shows the default, no error alert..
Any help is appreciated!!
How are you testing it?
Are you 'previewing' the email for the test lead?
or
actually sending the email in a smart campaign to that test lead?
The first way does not correctly test velocity scripts. You have to 'actually launch' a smart campaign to test it.
Please feel free to reach out if you need help.
Rajesh
Just because this is a common error: If ${A} is lead or custom object you have to tick its box in the right hand navigation pane. Otherwise the script won't work.
You might want to try writing it up where the criteria is all inside the parentheses for the if statement. Here's an example of a line with the && criteria:
#if ($xDaysAgo < $marginErrorUp && $xDaysAgo > $marginErrorDown)