Team, I am trying to use render.mergeEmail in a su...
# suitescript
a
Team, I am trying to use render.mergeEmail in a suitescript to send a dunning email to a customer. The email dunning template I use contains a table showing a list of invoices. There is a section on the template to list the invoices: <#list invoicelist as invoice> Of course when I run my script, there is no invoices on the list. My question is how do I pass the “invoicelist” variable to the email template? I have tried to pass a custom record, using the customRecord of the “render.mergeEmail” and then refer to it on the template, but it’s not working. Thanks.
l
Hi Antonio, you can use TemplateRenderer.addCustomDataSource to add the list of invoices as a array
a
hi @Luiz Morais thanks! I will try that right away!
@Luiz Morais I have created a renderer and added the custom data source. But how can I do a mail merge from the renderer?
l
you need to send your template as string on templateContent property then get the merged result from
Copy code
renderer.renderAsString();
a
and use that string on the email body?
l
yes
a
ok, thanks, let me try that
@Luiz Morais thanks a lot!. I have managed to do this using your approach.