Can I have an AND condition in my if conditional statement? | Community
Skip to main content
Level 6
March 17, 2025
Solved

Can I have an AND condition in my if conditional statement?

I would like to add an AND statement to my conditional statements in campaign. Is that possible and what is the syntax? I only found this article describing the syntax: https://experienceleague.adobe.com/en/docs/campaign-web/v8/content/dynamic-content/conditions


<% if (recipient.gender == ${model.gender} ) {
%>

<p> Conditional content </p>
<% }
else {
%>
<p>Default Content</p>
<% } %>
ParthaSarathy
ParthaSarathyAccepted solution
New Participant
March 17, 2025

Hi @anasustic ,

Yes, you can add.

<% if (recipient.firstName == 'abc' && recipient.lastName == 'xyx' ) { %>

 

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

3 replies

ParthaSarathy
ParthaSarathyAccepted solution
New Participant
March 17, 2025

Hi @anasustic ,

Yes, you can add.

<% if (recipient.firstName == 'abc' && recipient.lastName == 'xyx' ) { %>

 

Translate
 ~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
anasusticAuthor
Level 6
March 17, 2025

Hi @ParthaSarathy 
Is the OR operator in the if statement allowed and are two AND operators in the if statement allowed?

 

Translate
ParthaSarathy
New Participant
March 17, 2025

Yes,allowed. You can use || for OR

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