We are creating advanced pdf templates for Stateme...
# suitescript
b
We are creating advanced pdf templates for Statements but how could we do that using SuiteScripts? Is there any method to add custom data source to that template please?
n
Yeah using the N/render module. I think typically you'd have a button press call a suitelet that generates the pdf for you rendered by the render module https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4412042824.html
b
@Nathan L But the issue is how to pass "statements" data to that template
e
render.statement(options)
n
Yeah like ec said. Theres several built in functions on that link that have some pretty good code examples of what youre trying to do
The gist of it is, you load a rederer, assign a template, give the template your data source, render the pdf, then save it/display it
e
yes, interestingly I once tried to use a Workflow to generate statements (though I NEVER use Workflows) and it was missing the subsidiary option - which was a must in this multi-subsidiary environment I was working in.
b
Thank you @Nathan L @ec
👍 2
@ec that render.statement() function returns pdf template or source code, right? I mean if I have several templates, I can't select one template other than preferred one?
e
do you mean to say you have to select the appropriate template? see image
look up the help on that call, you will have what you need
b
Thank you. but I want to pass some other data to that template using SuiteScripts like JSON data, etc