TemplateRenderer.setTemplateById(options)
Method Description |
Sets the template using the internal ID. |
Returns |
void |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2016.1 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
number |
required |
Internal ID of the template. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/render Module Script Samples.
//Add additional code
...
var renderer = render.create();
renderer.setTemplateById(3);
var xml = renderer.renderAsString();
...
//Add additional code
For more information, see Advanced Templates and Advanced PDF/HTML Templates.
To find the template ID, search for PDF Templates or Advanced PDF/HTML Templates in NetSuite.
When the list of templates is displayed, hover your cursor on the Edit or Customize link. You can also see the ID in the browser’s URL when you click the link. An example of a Standard PDF template with an ID of 4 is /app/crm/common/merge/pdftemplate.nl?id=4
. An example of an Advanced HTML template with an ID of 19 is /app/common/custom/advancedprint/pdftemplate.nl?id=19
.
IDs from both Standard and Advanced Templates are supported.