Question
Using logical operators and conditional statements within the email editor of Adobe Campaign Standard
Hi team,
I have been having some trying to get a piece of javascript working within the HTML section of the email editor in ACS. Currently, when I execute a delivery with this code in it the delivery sends fine:
<% if (context.targetData.lastName == 'Ross' && context.targetData.firstName == 'Bob') { %>Bob<% } else if (context.targetData.lastName == 'Smith' && context.targetData.firstName == 'John') { %>John<% } else if (context.targetData.lastName == 'Williams' && context.targetData.firstName == 'Robbie') { %>Robbie<% } else { %>Hancock<% } %>
. However when I change the operator to an 'OR' statement the delivery errors out.
<% if (context.targetData.lastName == 'Ross' || context.targetData.firstName == 'Bob') { %>Bob<% } else if (context.targetData.lastName == 'Smith' && context.targetData.firstName == 'John') { %>John<% } else if (context.targetData.lastName == 'Williams' && context.targetData.firstName == 'Robbie') { %>Robbie<% } else { %>Hancock<% } %>
Does anyone know what is wrong with the second piece of code?