Expand my Community achievements bar.

Content Blocks / Javascript in Adobe Campaign Standard

Avatar

Level 1

Content Blocks / Javascript in Adobe Campaign Standard

I'm currently looking to implement Content blocks containing Javascript in several transactional emails. This is with the intention of replicating certain functionality across multiple transactional emails for code re-use.

 

I have seen several topics where other users have tried using Javascript within content blocks to iterate through product lists but havn't found anything about obtaining specific information sent across in those product lists. This could be to select the name or price of a product during an iteration.

 

I understand product list loops can be implemented through the editor, but there may be things that need implementing outside its scope.

 

To put my case in perspective, I have been using the following json to populate a two products within a listing. 

{
      "EVTabandonedBasketProductList": [
       {
            "EVTabandonedProductDecription": "Domaine Reverdy’s fine 2020 epitomises the elegant, complex and minerally character that has made Sancerre an enduring benchmark style for centuries.",
           "EVTabandonedProductName": "Domaine Reverdy’s fine 2020",
           "EVTabandonedProductPrice": 20,
           "EVTabandonedProductSize": ".75l",
           "EVTabandonedProductSku": "0475420"
     },
    {
          "EVTabandonedProductDecription": "This exquisite Sancerre is from the Laportes’ small family domaine in Chavignol, long regarded as one of the appellation’s top crus.",
          "EVTabandonedProductName": "Domaine Serge Laporte Sancerre 2020",
          "EVTabandonedProductPrice": 21,
          "EVTabandonedProductSize": ".75l",
          "EVTabandonedProductSku": "2239520"
    }]
}

 

I found out the EVTabandonBasketProductList is setup as EntityCollection Object which can be iterated through via a for and for each loop.

 

This is a simple snippit I used to iterate through the product list.


<%
    for each (var entity in context.rtEvent.ctx.EVTabandonedBasketProductList) {

        for each (var wpp in entity) {
             document.write(wpp + '<br>')
        }
        document.write('<br><br>')
   }
%>

 

Even though all the values display correctly within my tests, there seems no way of displaying or selecting a specific value from the WppObject without an error occurring or the email not sending at all.

 

<%= wpp.name %> would show up 'undefined'

 

Am I going about this the wrong way?

0 Replies