Expand my Community achievements bar.

SOLVED

ACS - email template and javascript / product listing

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

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

Avatar

Level 2

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