ACS - email template and javascript / product listing | Community
Skip to main content
Level 2
July 27, 2021
Solved

ACS - email template and javascript / product listing

  • July 27, 2021
  • 1 reply
  • 1141 views

Hi all

is it possible to have a clear reference/example of ACS capabilities in terms of javascript customization of email templates?

 

For instance: we have some custom "product listing" requirements that are not easily implemented using out of the box functionality.
We need to be able to apply some behavour on every list item, depending of some attributes and so we may need to script the iteration.

 

For example (pseudo code):

 

<% for (int i=0; i<productList.length; i++) {

var product = productList[i];

%>

<tr>

<%

if (product.someproperty=='XX') {

%>

.....custom layout...

<%}%>

</tr>

<%}%>

Do you think that this is possible in ACS?

 

Thanks.


Fabio

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by bisswang

Hi Fabio,

there is no official documentation on JavaScript customization.

Only the "standard" way is documented. There are some JS customizations feasible but not documented and they might be removed in the future.

 

But technically you can solve the use case you described below:

  • Either via JavaScript
  • But also with dynamic content you should be able to solve the same in ACS

1 reply

bisswangAdobe EmployeeAccepted solution
Adobe Employee
July 27, 2021

Hi Fabio,

there is no official documentation on JavaScript customization.

Only the "standard" way is documented. There are some JS customizations feasible but not documented and they might be removed in the future.

 

But technically you can solve the use case you described below:

  • Either via JavaScript
  • But also with dynamic content you should be able to solve the same in ACS
Level 2
July 29, 2021

Hi, thanks for the reply.

Anyway we tried with Javascript but with no luck.
If we use someting very basic like:

<%
var products = context.rtEvent.ctx.products;
%>

<table>

<tbody>
<%
for each(var product in products) {
%>
<tr><td><%=product["productName"]%></td></tr>

<%

}
%>
we got that
(1) when we save the delivery, ACS rearranges the markup, moving the for-loop outside the table, someting like
<%for... {>

<%}>
<table>...</table>


(2) as productName prints "undefined" (while we are sure that "productName" is passed via API call)

What are we missing?

Thnx

Fabio