Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
ParthaSarathy
ParthaSarathyAccepted solution
Community Advisor
Feb 7, 2025 5:11 PM UTC

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

~  ParthaSarathy S

3 replies

ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
Feb 7, 2025 5:11 PM UTC

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

Translate
~  ParthaSarathy S
Level 3
Feb 9, 2025 7:59 PM UTC

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

Translate
ParthaSarathy
Community Advisor
Community Advisor
Feb 10, 2025 9:07 AM UTC

Hi @neelam1991 , Replied to your thread

Translate
~  ParthaSarathy S