Send email body as a table format

let emailbody = ‘<table border=”1″><tr><th><b>Document Number</b></th><th><b>Customer name</b></th><th><b>Date</b></th><th><b>Amount</b></th></tr>’;

                for (let i = 0; i < salesDet.length; i++) {

                    name = salesDet[i].cus;

                    tranid = salesDet[i].tranid;

                    trandate = salesDet[i].trandate;

                    amount = salesDet[i].amount;

                    supervisor = salesDet[i].super;

                    id = salesDet[i].internalid;

                    let link = “https://td2881124.app.netsuite.com/app/accounting/transactions/salesord.nl?id=” + id + “&whence=”;

                    emailbody += “<tr>” +

                        ” <td><a href= “ + link + “>” + tranid + “</a></td>” +

                        “<td>” + name + “</td>” +

                        “<td>” + trandate + “</td>” +

                        “<td>” + amount + “</td>” +

                        “</tr>”;

                    log.debug(“emailbody”, emailbody);

                }

                emailbody += ‘</table>’;

Leave a comment

Your email address will not be published. Required fields are marked *