I also thought of trying to make a custom transact...
# suitescript
s
I also thought of trying to make a custom transaction type so that I could use render.transaction and set the printMode to HTML. Both of these approaches feel a bit hacky. Not sure which one is worse.
e
I think I have done something similar following this approach:
var renderer = render.create();
renderer.templateContent = file.load({ id: ScriptVariables.TemplateID }).getContents();
renderer.addCustomDataSource({
alias: 'some_name_variable',
format: render.DataSource.OBJECT,
data: object_with_values_expected_on_template
});
I created my own HTML file using the Advanced PDF syntax, uploaded to the file cabinet, then I passed the data expected using the
.addCustomDataSource
It will work similar to handlebar or other template libraries You can then do:
renderer.renderAsPdf()
and create a file or whatever you need with the content.
s
Yes that is essentially what I want to do, the problem is I need the output to be HTML, not PDF, since I am using it for the body of an email message. Sadly, there is no renderAsHtml function.
No idea why NetSuite can’t provide something so simple