Personalization in Subject Line | Community
Skip to main content
New Participant
Sep 13, 2021 3:28 PM UTC
Question

Personalization in Subject Line

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.

4 replies

Sukrity_Wadhwa
Employee
Sep 22, 2021 10:41 AM UTC

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!

Translate
Sukrity Wadhwa
Jyoti_Yadav
Level 8
Sep 14, 2021 4:54 AM UTC

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

 

Translate
garritoAuthor
New Participant
Sep 14, 2021 8:53 AM UTC

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 😞

Translate
Jyoti_Yadav
Level 8
Sep 16, 2021 7:46 AM UTC

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

 

Translate