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

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

  • March 17, 2025
  • 1 reply
  • 667 views

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>
<% } %>
Best answer by ParthaSarathy

Hi @anasustic ,

Yes, you can add.

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

 

1 reply

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
anasusticAuthor
New Participant
March 17, 2025

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

 

ParthaSarathy
New Participant
March 17, 2025

Yes,allowed. You can use || for OR

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