Add conditional statement (dynamic content) in the subject line | Community
Skip to main content
Level 2
Jan 14, 2021 3:37 AM UTC
Solved

Add conditional statement (dynamic content) in the subject line

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
bisswangAccepted solution
Employee
Jan 14, 2021 1:00 PM UTC

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

4 replies

Sukrity_Wadhwa
Employee
Jan 19, 2021 3:58 PM UTC

Hi @sarim60660,

Were you able to resolve this query or do you still need more help here? Do let us know.

Thanks!

Translate
Sukrity Wadhwa
Level 5
Jan 14, 2021 1:05 PM UTC

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

Translate
bisswangAccepted solution
Employee
Jan 14, 2021 1:00 PM UTC

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
Translate
Level 2
Jan 20, 2021 1:16 AM UTC
Hi Ramon, thanks for your feedback. And yes, I did able to resolved it by using the native way (UI). I was initially thinking to use the code directly but its not recommended in ACS. Thanks!!!
Translate