Expression fragment - new to Campaign V8 | Community
Skip to main content
Best answer by ParthaSarathy

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

1 reply

ParthaSarathy
ParthaSarathyAccepted solution
New Participant
February 7, 2025

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~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
New Participant
February 9, 2025

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

ParthaSarathy
New Participant
February 10, 2025

Hi @neelam1991 , Replied to your thread

 ~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups