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?

  • March 17, 2025
  • 1 reply
  • 670 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>
<% } %>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ParthaSarathy

Hi @anasustic ,

Yes, you can add.

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

 

1 reply

ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
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
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?

 

ParthaSarathy
Community Advisor
Community Advisor
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