Add conditional statement (dynamic content) in the subject line

Avatar

Avatar

Sarim60660

Avatar

Sarim60660

Sarim60660

13-01-2021

Hello,

 

I am trying to use dynamic content in the subject line based on the values in "gender" field. Gender field can have 3 values:

 

Male

Female

Default

 

I was trying to use this but it's not working:

 

Hello <%if(context.profile.gender=='Male'){%>
Gentlemen<%} else if(context.profile.gender=='Female'){%>
Ladies<%}else{%>Everyone<%}%>, Season Sale ends today!

 

Any tips/ideas how to edit this?

 

Thanks!

 

AK

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar

johnwwilcoxmba

Avatar

johnwwilcoxmba

johnwwilcoxmba

14-01-2021

Gender is stored as an integer in the DB.  So you may need to check for "1" = Male, "2" = Female, or "0" = unknown.

Avatar

Avatar

ramon_bisswange

Employee

Avatar

ramon_bisswange

Employee

ramon_bisswange
Employee

14-01-2021

The "native" way to do this would be to use Dynamic Content.

You can enable that also for subjects with the icon below the subject text:

  • Enter text for e.g. Male
  • Select the text
  • Click New Dynamic Content
  • Add additonal versions including related conditions