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

ACS - email template and javascript / product listing

fabiosurini
Level 1
Level 1

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
ramon_bisswanger
Correct answer by
Employee
Employee

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
ramon_bisswanger
Correct answer by
Employee
Employee

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

fabiosurini
Level 1
Level 1

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