Personalization block in Email subject



Hi All,

For my segmentation purpose, I am using a personalization block in my email delivery's subject line. Inside this personalization block, I am doing a soap call to fetch the subject appropriate for my segment. However, if after evaluation, if I get 'Hi <%= recipient.firstName %>' this recipient firstName part is not getting evaluated, rather i am getting the subject as 'Hi <%= recipient.firstName %>' not as 'Hi Jessie' (considering 'Jessie' is the recipient's first name).

Anyone has ever tried something like this? Any idea what I am doing wrong here?

Appreciate your response.

Thanks & regards

Accepted Solutions (1)

Accepted Solutions (1)



In case it is of any interest to anyone, I was looking for a solution to this.

There is a function called evaluateTemplate() that would have worked for this, but it is not available in the delivery context, but only in a javascript workflow action.

So I manually searched and replaced the string that comes with personalization vars, similar to the following:

(This assumes that instead of <%= and %> the string comes with %JS_START% and %JS_END%. The reason I do this is that I want to _paste_ this code into a string, and having %> in a string will escape away from the _whole_ script)


var dynamicSL = "%JS_START% recipient.firstName %JS_END%, today is %JS_START% formatDate(new Date(), '%Al')%JS_END%.";

var myRegEx = /%JS_START%.+?%JS_END%/g;

var evalPersonalization = function (str) {

   return eval(str.substr(10, str.length-18));


var finalSubjectLine = dynamicSL.replace(myRegEx, evalPersonalization);


<%= finalSubjectLine %>

Answers (5)

Answers (5)



supratim320​ Did you ever manage to find a solution for this issue? I'm facing the same problem. I'm pretty sure that eval'ing the string 'Hi <%= recipient.firstName %>'  won't work, so I'm looking into building a search-and-replace kind of solution where I check for probably just '<%='.




I'm not 100% sure that personalization blocks can be inserted in subject lines, but you can still use variables as Marjorie explained, as well as conditionality (Conditional content). Would that be enough as a workaround?





As stated, I am using a personalization block within the 'Subject' line, so I cannot mention subject module as you've mentioned. In my personalization block, I am driving various logic and deciding on final o/p and I am evaluating the subject. At the o/p of my personalization block, I am getting output = 'Hi <%= recipient.firstName %>' and then I am using <%=subject %>, I am not getting 'Hi Jessie', instead I am getting 'Hi <%= recipient.firstName %>' - in a nutshell, using personalization block, it is not evaluating the tags



Bonjour !

Cela fonctionne pour moi, j'ai une diffusion récurrente avec comme objet :


Avez-vous bien été chercher la variable en cliquant sur objet puis sur 1396051_pastedImage_1.png ?

Bonne journée,