Advanced HTML/PDF Templates as XML Definitions
SuiteCloud Development Framework (SDF) supports advanced PDF/HTML templates that can be associated with transaction forms. The advancedpdftemplate
SDF custom object can be used to develop advanced PDF/HTML templates in a SuiteCloud project. You can create new SDF custom objects, or import existing objects into your SuitCloud project using SuiteCloud IDE plug-in or SuiteCloud CLI.
There are two components to advanced PDF/HTML templates in a SuiteCloud project:
-
The
advancedpdftemplate
SDF custom object file, which contains the XML definition of the template record. The file name requires the prefixcusttmpl
, for examplecusttmpl_paymentvoucher.xml
. -
The template definition file, which contains the information that defines the template. There are existing template definitions that you can customize for your business needs. The template definition file is automatically created when you create an
advancedpdftemplate
SDF custom object file in SuiteCloud IDE. The template definition is also included when importing theadvancedpdftemplate
SDF custom object into your SuiteCloud project.The file name must be of the form
scriptID
.template.xml, wherescriptID
is the script ID of theadvancedpdftemplate
object and also the object file name without the file extension. For example,custtmpl_paymentvoucher.template.xml
is the template definition for the SDF custom objectcusttmpl_paymentvoucher.xml
. The template definition file is located in the same objects folder as theadvancedpdftemplate
SDF custom object file. The file name provides the means for NetSuite to match the template definition with the template record when the objects are deployed to an account.For information about templates, see Reviewing Available Advanced Templates and Advanced Templates Customization in the Template Editor.
To deploy advanced PDF/HTML templates to a target NetSuite account, enable the Advanced PDF/HTML Templates feature. For more information, see Enabling the Advanced PDF/HTML Templates Feature.
For information about creating or editing advanced PDF/HTML templates, see the following:
Validating Advanced HTML/PDF Templates in an XML Definition
Consider the following information when validating advancedpdftemplate
SDF custom objects:
-
The
advancedpdftemplate
SDF custom object file name requires the prefixcusttmpl
, for examplecusttmpl_paymentvoucher.xml
. -
The template definition file name must be of the form
scriptID
.template.xml, wherescriptID
is the script ID of theadvancedpdftemplate
object and also the object file name without the file extension. For example,custtmpl_paymentvoucher.template.xml
is the template definition for the SDF custom objectcusttmpl_paymentvoucher.xml
. The template definition file is located in the same objects folder as theadvancedpdftemplate
SDF custom object file. -
The
ADVANCEDPRINTING
feature must be added to the manifest as a required feature. -
The contents of the template definition file, including form print and email template fields, are not validated. Ensure the correct type of template is specified in those fields. For information about templates, see Reviewing Available Advanced Templates and Advanced Templates Customization in the Template Editor.
-
The form transaction type must match the advanced PDF template transaction type.
-
The
savedsearch
criteria are not validated. -
Ensure there is only one PDF template within the project that has the preferred field set to T per template type. If there are multiple PDF templates of the same type with the preferred field set to T, they will override each other in sequence because only one per type can be the preferred type.
-
If the PDF template is for a custom transaction type, no deployment error is returned when the account is not specified for that transaction type. Under those conditions, an error is displayed when that PDF template is later opened in the NetSuite UI. To avoid the error, specify the account for the custom transaction type in the NetSuite UI prior to opening the PDF template.
Advanced HTML/PDF Template XML Definition Example
The following is an example of an advancedpdftemplate
SDF custom object that customizes a payment voucher PDF/HTML template:
<advancedpdftemplate scriptid="custtmpl_100_1326288_617" standard="STDTMPLPAYMENTVOUCHER">
<description>This template is used for payment vouchers.</description>
<displaysourcecode>F</displaysourcecode>
<isinactive>F</isinactive>
<preferred>T</preferred>
<title>Custom Payment Voucher PDF/HTML Template</title>
</advancedpdftemplate>
The advancedpdftemplate
SDF custom object example has the file name custtmpl_paymentvoucher.xml.
The SDF custom object requires a template definition file with the file name custtmpl_paymentvoucher.template.xml
, which contains the HTML code that defines the advanced HTML/PDF template. The content of custtmpl_paymentvoucher.template.xml
is beyond the scope of this example, but can be based on the customization of the Standard Payment Voucher PDF/HTML Template, which is a standard advanced PDF/HTML template in NetSuite.