Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

Personalization variable in Delivery

Avatar

Level 2

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, 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

The targetData is only available when you start the delivery from a workflow.

Also you  won't see the option to use it with standard tools menu, but you will see it if you open the delivery from the workflow view (Open the targeting worflow, the "delivery" activity, the loop to open the delivery details and then you should be able to use the personalization menu to find 'Target Extension').

But as it can only be used with a workflow, it doesn't allow to preview the message (with the 'Preview' tab in the delivery form). It is a logical limitation, the only way to check your message is to send it (a proof or real message, as you want).

 

The simpliest way for your example to avoid the use of targetData, if the salutation is a field of your target schema (let's say nms:recipient ?), is to just write the following syntax :

<%= recipient.salutation %>

(or use the name of you schema if it's not recipient).

 

Cedric

View solution in original post

5 Replies

Avatar

Community Advisor

Hi @J2021 , I think you mix up the delivery variables and the personalization variables.

What you are doing is to use let's say a "global" variable with "delivery.variables". It means that this object will be the same for every recipient of your delivery.

I suppose you don't want this.

You'll have to load this salutation in the custom personalization datas, because depending of the size of your target, you won't be able to load all the personalizations into a unique global variable.

 

I'm suprised why can't you use the target data extension ?

You mean that the code

<div><%=targetData.salutation%></div>

is not an option for you ?

 

Cedric

 

Avatar

Level 2

Hi @CedricRey ,

 

Ah that makes a lot of sense. I couldn't find the setting behind the delivery variables so that's why i tried it this way. 

 

If i try to make use of the targetData variable it gives an error. And when i'm in the email itself i don't have the option to enrich it with targetData personalization as shown below. 

 

J2021_0-1652172917845.png

 

So that's why i went looking for another way to do the personalization. But i'm starting to wonder if there is another way to do it without the targetData. 

Avatar

Correct answer by
Community Advisor

Hi,

The targetData is only available when you start the delivery from a workflow.

Also you  won't see the option to use it with standard tools menu, but you will see it if you open the delivery from the workflow view (Open the targeting worflow, the "delivery" activity, the loop to open the delivery details and then you should be able to use the personalization menu to find 'Target Extension').

But as it can only be used with a workflow, it doesn't allow to preview the message (with the 'Preview' tab in the delivery form). It is a logical limitation, the only way to check your message is to send it (a proof or real message, as you want).

 

The simpliest way for your example to avoid the use of targetData, if the salutation is a field of your target schema (let's say nms:recipient ?), is to just write the following syntax :

<%= recipient.salutation %>

(or use the name of you schema if it's not recipient).

 

Cedric

Avatar

Level 2

Hi @CedricRey 

 

I am sending this delivery through a workflow. So that's why i find it strange the option for TargetData isn't there. Is this something that has to be implemented in an Adobe setup or does it always come with the setup? 

 

I will try it with the other option. Thank you!

Avatar

Community Advisor

Hi @J2021 this is not an option, it come as it. But if you don't see it, it can be explained (as it must be opened from the workflow, the context is passed thru the forms and something can be lost).

Another thing : to be sure that "targetData.salutation" is available on the delivery, can you force an alias in the query/enrich activity where you got this field ? Just put "@salutation", and check it in the workflow flow by pausing the delivery (right click on the deliv activity, "Activate but don't execute"), right click on the entering transition, second tab 'display target' and check the schema if salutation has the right name)

 

Cedric