Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Adding additional personalization data in BuildPreviewFromId function

richac96395021
Level 5
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
wodnicki
Correct answer by
Community Advisor
Community Advisor

Hi,

Previews will generate same output as deliveries to seeds:

Thanks,

-Jon

View solution in original post

4 Replies
wodnicki
Community Advisor
Community Advisor

Hi,

For targetData, you need to use seeds:

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

Thanks,

-Jon

Florian_Courgey
Community Advisor
Community Advisor

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 

richac96395021
Level 5
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

wodnicki
Correct answer by
Community Advisor
Community Advisor

Hi,

Previews will generate same output as deliveries to seeds:

Thanks,

-Jon

View solution in original post