Managing a condition from an element of a collection (Transacctional message) | Community
Skip to main content
Level 2
December 19, 2022
Solved

Managing a condition from an element of a collection (Transacctional message)

  • December 19, 2022
  • 2 replies
  • 846 views

Hi,
I have a request where I need to apply a different format when a condition is false.
This condition must affect to a line of a collection of articles (an article of a product list)
I have created a boolean element within a collection, however the boolean I have create is not available when I try to applicate a new condition to a field of the transacctional message.
Is there are way to use this kind of element (of a collection) as a event to be used as a condition?

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 SatheeskannaK

Hi @bravoga1977,

 

Try to create content block and reference the same in product listing to see if it works. It will look like something below,

 

<table>
<% for (var i =0; i < context.rtEvent.ctx.articleCollection.length; i++) { %>
<% if (context.rtEvent.ctx.articleCollection[i].articleAvailable == true) { %>
<tr>
<td>
<table>
<tbody>
<tr>
<td >
<%= context.rtEvent.ctx.articleCollection[i].articleName %>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<% } %>
<% } %>
</table>

2 replies

SatheeskannaK
Community Advisor
SatheeskannaKCommunity AdvisorAccepted solution
Community Advisor
December 19, 2022

Hi @bravoga1977,

 

Try to create content block and reference the same in product listing to see if it works. It will look like something below,

 

<table>
<% for (var i =0; i < context.rtEvent.ctx.articleCollection.length; i++) { %>
<% if (context.rtEvent.ctx.articleCollection[i].articleAvailable == true) { %>
<tr>
<td>
<table>
<tbody>
<tr>
<td >
<%= context.rtEvent.ctx.articleCollection[i].articleName %>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<% } %>
<% } %>
</table>

Thanks, Sathees
Sukrity_Wadhwa
Community Manager
Community Manager
January 12, 2023

Hi @bravoga1977,

Was @satheeskannak's solution helpful to resolve your query? In case it was helpful, then kindly choose it as the 'Correct Reply'. If not and you still need more help, then do let us know.

Thanks!

Sukrity Wadhwa
Level 2
January 12, 2023

Hi @sukrity_wadhwa,

 

Well, it was not the solution I was looking for but guided me a bit on the path to follow.

Thanks!

Sukrity_Wadhwa
Community Manager
Community Manager
January 12, 2023

Glad to know it helped you a bit. 🙂 

Could you please share the solution with the rest of the Community as well so that it helps them too in case they are facing the same issue? 

Thanks!

Sukrity Wadhwa