Skip to main content
Level 6
Mar 17, 2025 3:23 PM UTC
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>
<% } %>
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
Mar 17, 2025 3:27 PM UTC

Hi @anasustic ,

Yes, you can add.

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

 

~  ParthaSarathy S

3 replies

ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
Mar 17, 2025 3:27 PM UTC

Hi @anasustic ,

Yes, you can add.

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

 

Translate
~  ParthaSarathy S
anasusticAuthor
Level 6
Mar 17, 2025 3:33 PM UTC

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

 

Translate
ParthaSarathy
Community Advisor
Community Advisor
Mar 17, 2025 4:07 PM UTC

Yes,allowed. You can use || for OR

Translate
~  ParthaSarathy S