Dynamic table in html email

Hello, How do I insert an HTML table containing the content of my list into an email?

Before I used:
{{ExportProfessionnels.join('\n', 'raison')}}

but I only have one field in my list

thanks

This is how I made this:

  1. Create array that will hold your table data
  2. Do a repeat against what you need to repeat
  3. Add in to the array your table data together with HTML. My example: '<tr><td>'+destination+'</td><td>'+period+'</td><td>€'+currentPrice+'</td><td style="background-color: #eaf7ea">– €'+priceChange+'</td>'
  4. Add step to get array data as variable
  5. On Email Sent use variable from previous step as table data. My example:
<body>
    <div class="email-container">
        <h1>AirBaltic Tickets Price Update</h1>
        <hr class="horizontal-line">
        <table>
            <thead>
                <tr>
                    <th>Destination</th>
                    <th>Period</th>
                    <th>Current Price</th>
                    <th>Price Change</th>
                </tr>
            </thead>
            <tbody>
{{tableData.join('', 'rowData')}}
            </tbody>
        </table>
    </div>
</body>

Would be interesting to see other solutions.

4 Likes

Thanks Notum