Personalization variable in Delivery
Hi,
I want to have a personalized salutation in my emails. So it opens with something like:
Dear John
Dear Maria
etc.
Because of the way our setup is established i cannot use the target data extension for personalization. So i tried it with javascript code and the delivery variables. But i'm stuck, because the salutation it picks is only the last one on the list.
So i'm only getting:
Dear John
Dear John
Dear John etc.
My javascript skills are very basic so maybe i'm doing something wrong.
This is the code i use in the delivery:
var schemaName = vars.targetSchema.substr(vars.targetSchema.indexOf(":") + 1);
var query = xtk.queryDef.create(
<queryDef schema={vars.targetSchema} operation="select">
<select>
<node expr="salutation"/>
</select>
</queryDef>
);
result = query.ExecuteQuery();
for each (var e in result) {
delivery.variables._var[0].stringValue = e.salutation
}
Thank you in advance 🙂
Kind regards,