I'm trying to load an existing Advanced PDF/HTML Template, transform it to a string, do some changes to it and print it to a pdf file. The only thing that so far seems to not be possible is loading the template. Once I have it as string, the rest should be easy with the N/render module. I tried getting to it by a saved search but it's no search option. Loading it from the file would be the obvious way to go but there doesn't seem to be a file where the template is saved in (at least not in the file cabinet).
The current setup consists of 3 scripts. 1st is a UserEventScript adding a button to a form. 2nd is a ClientScript called by button click. 3rd is a RESTlet triggered by the ClientScript, gathering data and supposed to be doing the magic.
I can't just use different print templates because the final solution is supposed to be used as SuiteApp thus has to be as dynamic as possible.
Any hints?
Okay, took some time but I figured it out.
var renderer = render.create();
renderer.setTemplateByScriptId('ID_OF_TEMPLATE');
var template_data = renderer.templateContent;