Expand my Community achievements bar.

SOLVED

Expression fragment - new to Campaign V8

Avatar

Level 9

What do you think about this expression syntax?

<%
<% if (<recipient.age >= 40) {
%>Good morning <%recipient.firstName! %> <%
}
else if (<FIELD>==<VALUE>) {
%>Hi <%recipient.firstName %> <% }
%>

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Michael_Soprano ,

This is normal 'If - else if - else' condition. But the correct syntax is as follows,

<% if ( recipient.age >= 40 ) { %>
Good morning  <%= recipient.firstName %> 

<% } else if ( recipient.age == 30 ) { %>
Hello <%= recipient.firstName %>

<% } else { %> Hi <%= recipient.firstName %> <% } %>

recipient.age > This will fetch recipient's Age from the database

<%= recipient.firstName %> > This print's recipient's Firstname in the email.


So, If the Age is greater than or equal to 40, the recipient will receive email as Good morning Abcd; whereas if the age is 30, the receive mail as Hello Abcd, and rest of the recipients will receive email as Hi Abcd

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @Michael_Soprano ,

This is normal 'If - else if - else' condition. But the correct syntax is as follows,

<% if ( recipient.age >= 40 ) { %>
Good morning  <%= recipient.firstName %> 

<% } else if ( recipient.age == 30 ) { %>
Hello <%= recipient.firstName %>

<% } else { %> Hi <%= recipient.firstName %> <% } %>

recipient.age > This will fetch recipient's Age from the database

<%= recipient.firstName %> > This print's recipient's Firstname in the email.


So, If the Age is greater than or equal to 40, the recipient will receive email as Good morning Abcd; whereas if the age is 30, the receive mail as Hello Abcd, and rest of the recipients will receive email as Hi Abcd

Avatar

Level 2

@ParthaSarathy Could you pls help me with the resolution for the issue m facing. its elaborated in "Read Javascript variables in Delivery"

Avatar

Community Advisor