Expand my Community achievements bar.

Personalization in Subject Line

Avatar

Level 1

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!

4 Replies

Avatar

Community Advisor

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

 

Avatar

Level 1

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

Avatar

Community Advisor

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

 

Avatar

Administrator

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