Personalization in Subject Line | Community
Skip to main content
September 13, 2021
Question

Personalization in Subject Line

  • September 13, 2021
  • 2 replies
  • 1447 views

Hello all,

 

I'm kind of stuck on this one, I need to do a personalization code in the Subject Line of an email. The problem is that the SL already has a personalziation and I cannot find the proper way to do it.

This is the personalization:

<% if(recipient.firstName!=""){%><%= recipient.firstName %>, welcome to the club at <%= recipient.child.indicators.babyMonth %> months old!<% }else{ %>–Welcome to the club at <%= recipient.child.indicators.babyMonth %> months old!<% } %>

 

The issue is that in here, I will need to include another IF statement:

- if the babyMonth is less than 0: Welcome to the club at <%= recipient.child.indicators.babyWeek %> weeks old!

- if the babyMonth is greater than 0: the original code.


How should I add this into the block?

Thank you very much!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Jyoti_Yadav
Level 8
September 14, 2021

Hi @garrito ,

 

You can use below code for the situation:

 

<% if(recipient.firstName!=""){ if(recipient.child.indicators.babyMonth<0){ %> <%= recipient.firstName %>, welcome to the club at <%= recipient.child.indicators.babyWeek %> weeks old! <%} else{ %> <%= recipient.firstName %>, welcome to the club at <%= recipient.child.indicators.babyMonth %> months old!<%} }else{ %>–Welcome to the club at <%= recipient.child.indicators.babyMonth %> months old!<% } %>

 

Thanks,

Jyoti

 

garritoAuthor
September 14, 2021

Hi @jyoti_yadav 
Thank you very much for your help!

 

I tested it and it didn't work, the proof still gives me the MONTHS not WEEKS 😞

Jyoti_Yadav
Level 8
September 16, 2021

Hi @garrito ,

 

Does your database has babymonth value less than zero. Please check your dataset.

If value is not less than zero, then you can use below syntax to achieve your output:

<% if(recipient.firstName!=""){ if(recipient.child.indicators.babyWeek<4 ){ %> <%= recipient.firstName %>, welcome to the club at <%= recipient.child.indicators.babyWeek %> weeks old! <%} else{ %> <%= recipient.firstName %>, welcome to the club at <%= recipient.child.indicators.babyMonth %> months old!<%} }else{ %>–Welcome to the club at <%= recipient.child.indicators.babyMonth %> months old!<% } %>

 

Thanks

 

Sukrity_Wadhwa
Community Manager
Community Manager
September 22, 2021

Hi @garrito,

 

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


Thanks!

Sukrity Wadhwa