Expand my Community achievements bar.

SOLVED

Adding additional personalization data in BuildPreviewFromId function

Avatar

Level 5

Hi team,

We are using BuildPreviewFromId function in javascript, please let me know if we can add more personalization like 'targetData.amount' while calling the function. Below is the function definition:-

var res = nms.delivery.BuildPreviewFromId(

  deliveryId,

  <params content="html" filter="@id=1234"/>)

var preview  = res[0]

var queryResult = res[1]

with regards,

Richa Chaubey

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

Previews will generate same output as deliveries to seeds:

Thanks,

-Jon

View solution in original post

4 Replies

Avatar

Community Advisor

Hi,

For targetData, you need to use seeds:

<params content="html" filter="@id = 1234" schema="nms:seedMember"/>

Thanks,

-Jon

Thanks! It worked for our custom cus:deliveryPreview.jssp :

var target    = request.getParameter("target") || "XXX"; // default to XXX
var targetSchema    = request.getParameter("targetSchema") || "XXX"; // default to XXX
[...]
//var deliveryParam     = <params content={contentType} filter={decryptedTarget}/>; // replaced by below code
var deliveryParam = <params content="html" filter="@id = 0" schema="nms:seedMember"/>; // using a seed address allows deliveries with targetData to work
var res               = nms.delivery.BuildPreviewFromId(deliveryId,deliveryParam);

 You may now use https://xxx.neolane.net/cus/deliveryPreview.jssp?messageType=0&id=1234&contentType=html 

Avatar

Level 5

Hi Jon,

In the above function definition, how will the target extension attributes will be referred in personalization. For example @amount is part of cus: transactions schema (target extension) and not nms:seedMember schema. How will the preview generate

With regards,

Richa Chaubey

Avatar

Correct answer by
Community Advisor

Hi,

Previews will generate same output as deliveries to seeds:

Thanks,

-Jon